Open anthares-dev opened 3 years ago
I posted a link to this where this occurs based off the examples provided in the documentation.
https://codesandbox.io/s/jolly-ishizaka-5e3im shows the errors that I've been getting. This happens in any version greater than 2.0
I have the same problem, usePDF
seems to go into an infinite loop. I think the problem resides in the pdf
function, its onChange
is called in a loop(?)
Also, usePDF
does not remove the pdf change
listener, because of that even after unmounting the component that uses usePDF
the loop continues, eventually freezing the browser.
This is extremely annoying for me. Moreover, these various blobs getting created seem to disappear so if you try to open the pdf in a new tab it may or may not be found, and it may or may not be downloadable after that point.
ca confirm this is stuck in an infinite loop originating from generating a blob inside of react-pdf
itself. There is nothing that can be done to use the hook in this state. its completely unusable at this stage, but this just creates problems for use cases that need to control the download flow of the pdf.
Tl;dr simply calling the hook in a remix component immediately loops at infintum and blocks the js thread doing so.
After updating to v2.0 appeared an unexpected behavior in BlobProvider: during rendering on the fly, the props "loading" and "url" changes continuously, making the document re-render multiple times, as you can see in the following screenshot:
BlobProvider is located in the parent component "ReportGenerator.js", the document is located in the child component "MyDocument". Here an extract of my code:
In MyDocument component there is no state change, just StyleSheet.create method and React Pdf components taking data from props. Props and states in parent component don't change as well.
After this multiple re-rendering, the pdf at last appears. Moreover, if I use Dynamic content, like the page number in a footer, the re-rendering go in infinite loop, crashing the browser tab.
Have you and idea why this is happening? Thank you so much in advance!
Desktop: