sendWithPromise("GetPage", ... null causing an error
See original GitHub issueBefore you start - checklist
- I followed instructions in documentation written for my React-PDF version
- I have checked if this bug is not already reported
- I have checked if an issue is not listed in Known issues
- If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo
Description
I use two instances of react-pdf. The main viewer is using a functional component and the second one is a class-based that’s not visible. It’s a background renderer to produce pdf thumbnail previews. This has been working fine since 2021.
After recently pulling down 5.7.2 my background PDF render throws an error just before it renders. After reverting to 5.7.1 it’s working fine.
- load 1 PDF it’s fine
- load another PDF it breaks
I put error handlers on the <Document...
and <Page..
. I have onSourceError
, onLoadError
, onRendeError
handlers but those don’t fire, the error above happens.
I will continue investigating/work on reproducible code unfortunately what I’m working on is not public.
Attached below are the images of the error.
Steps to reproduce
Setup a class-based react-pdf component.
Pass down a file path (by props), it renders.
Pass down another file path
Expected behavior
The PDFs render as the sources are updated.
Actual behavior
Fails to render the PDF/produces the errors below
When this error happens it crashes the entire react app eg. blank screen.
Additional information
No response
Environment
- Browser (if applicable): Chrome
- React-PDF version: 5.7.2
- React version: ^4.42.0
- Webpack version (if applicable): ^16.3.0
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10 (3 by maintainers)
Top GitHub Comments
We’ve hit the same situation with an application using react 16.14. The first PDF seemed to load fine, but remounting or changing to a new PDF would result in errors.
Was able to workaround by rolling back to 5.7.1 as others have. Don’t have much else to add to previous reports, but did want to note that the root cause was one of a number of different errors on different subcomponents from Page down. For future search-ability, figured it was worth adding examples from a dev bundle created with 5.7.2:
We have this issue for the following flow: