You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand that React-PDF does not aim to be a fully-fledged PDF viewer and is only a tool to make one
I have checked if this feature request is not already reported
Description
Today it cumbersome to orchestrate loading states, e.g. when rendering only a single page I want the loader to show the same for both the <Document> and <Page>, I can pass the same element to both loader props, but often that causes the spinner to get out of sync.
The same issue applies to when lazy loading the module, if you want the same loading UI.
Proposed solution
Fully integrate Suspense into the library. Remove all props related to loading or error states and use Suspense and Error boundaries.
This also provides more control of the UX when navigating between pages. E.g. to load the next page before navigating, just wrap setPageNumber with a transition.
startTransition(()=>{setPageNumber((i)=>i+1);});
Alternatives
N/A
Additional information
Fully integrating Suspense would be a breaking change and likely require React 19 and above.
The text was updated successfully, but these errors were encountered:
Before you start - checklist
Description
Today it cumbersome to orchestrate loading states, e.g. when rendering only a single page I want the loader to show the same for both the
<Document>
and<Page>
, I can pass the same element to bothloader
props, but often that causes the spinner to get out of sync.The same issue applies to when lazy loading the module, if you want the same loading UI.
Proposed solution
Fully integrate Suspense into the library. Remove all props related to loading or error states and use Suspense and Error boundaries.
Example how this would look
Want separate loading states for each page? Just wrap each page with a suspense boundary
This also provides more control of the UX when navigating between pages. E.g. to load the next page before navigating, just wrap
setPageNumber
with a transition.Alternatives
N/A
Additional information
Fully integrating Suspense would be a breaking change and likely require React 19 and above.
The text was updated successfully, but these errors were encountered: