react-pdf
react-pdf copied to clipboard
fix: use one pdf worker for all documents and for all rerenders
react-pdf
v5.3 with file-loader
creates new worker for all file's change and for all Document
instances, so I create a singleton that reuse worker while rerenders and in different documents
@wojtekmaj @jeetiss , does this help with loading a PDF fine when the browser is set to offline mode?
If it does, i'd really appreciate a sample reference. Thanks
@wojtekmaj @jeetiss , does this help with loading a PDF fine when the browser is set to offline mode?
If it does, i'd really appreciate a sample reference. Thanks
No, this is unrelated. In order to work in "offline mode", make sure to properly Configure PDF.js worker so it is locally available and not loaded from a CDN.
any progress?
will this help when handling large pdf?
any progress? what missing?
will this help when handling large pdf?
No. This could help with multiple instances of React PDF initialized at the same time only.
what missing?
There are two main concerns.
First - is this still even needed if file-loader is no longer recommended and instead, we pass worker URL to PDF.js?
Second - the package has been completely rewritten since so this code isn't compatible with the latest head. Although that's a minor issue, it can easily be rebased.