Skip to content

Conversation

HJZzzzz
Copy link

@HJZzzzz HJZzzzz commented Mar 19, 2025

Hi! Thanks for this amazing library!

This PR is just proposing a small addon regarding a issue i faced when building my own pdf viewer on top of react-pdf.

In my case, i need to know the specs that <Page/> element renders with, so i can tell whether the rendered version is the version i want.

Context: i faced the flickering issue when toggling specs like rotate, width, height.
To fix this, I added sth on top by leveraging on css transform that applied on the 'prev page', to shape it look like the page that about being rendered. (Getting inspirations from here #418)

However, when i keep toggling the specs of the page, i realized that the onRenderSuccess for the outdated specs might still be called.
ie: i quickly toggle it like: {rotate:90, width:100} -> {rotate: 180, width: 200} -> {rotate: 270, width: 200}
the renderSuccess callback for {rotate: 180, width: 200} might be triggered, even though the specs are already changed to {rotate: 270, width: 200}.

Thus, adding the renderContext param in the params will help me to know whether the onRenderSuccess is for rendering the correct specs.

@HJZzzzz
Copy link
Author

HJZzzzz commented Mar 21, 2025

@wojtekmaj Hi, just fixed the test in my local~ can trigger the pipeline and check again~

@HJZzzzz
Copy link
Author

HJZzzzz commented Mar 21, 2025

hmmm checked the pipeline and have no idea why it failed.
try the test, build and tsc in my local. all look ok

@wojtekmaj
Copy link
Owner

Yeah this ain't your fault. Something went wrong like 3 commits ago.

@HJZzzzz
Copy link
Author

HJZzzzz commented Mar 25, 2025

I see, then are you ok with merging this pr? maybe we can skip the pipeline?

@HJZzzzz
Copy link
Author

HJZzzzz commented Mar 25, 2025

btw, i realized that the /src directory is not excluded in the built package. Is this intended?
Screenshot 2025-03-25 at 2 42 12 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants