react-pdf-viewer
react-pdf-viewer copied to clipboard
Crash when loading a pdf in v3.0.0
This only happens in create-react-app v5 and only in weback-dev-server development mode, e.g. react-scripts start and not when using the built product react-scripts build.
Uncaught Error: Rendered fewer hooks than expected. This may be caused by an accidental early return statement.
at renderWithHooks (react-dom.development.js:15050)
at updateFunctionComponent (react-dom.development.js:17356)
at beginWork (react-dom.development.js:19063)
at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
at invokeGuardedCallback (react-dom.development.js:4056)
at beginWork$1 (react-dom.development.js:23964)
at performUnitOfWork (react-dom.development.js:22776)
at workLoopSync (react-dom.development.js:22707)
at renderRootSync (react-dom.development.js:22670)
renderWithHooks @ react-dom.development.js:15050
updateFunctionComponent @ react-dom.development.js:17356
beginWork @ react-dom.development.js:19063
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
beginWork$1 @ react-dom.development.js:23964
performUnitOfWork @ react-dom.development.js:22776
workLoopSync @ react-dom.development.js:22707
renderRootSync @ react-dom.development.js:22670
performSyncWorkOnRoot @ react-dom.development.js:22293
(anonymous) @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
flushSyncCallbackQueue @ react-dom.development.js:11309
flushPassiveEffectsImpl @ react-dom.development.js:23620
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushPassiveEffects @ react-dom.development.js:23447
(anonymous) @ react-dom.development.js:23324
workLoop @ scheduler.development.js:417
flushWork @ scheduler.development.js:390
performWorkUntilDeadline @ scheduler.development.js:157
react_devtools_backend.js:4045 The above error occurred in the <ThumbnailListWithStore> component:
at ThumbnailListWithStore (https://frontend.local.domain.com/static/js/bundle.js:126756:35)
at div
at div
at div
at Sidebar (https://frontend.local.domain.com/static/js/bundle.js:120692:33)
at div
at div
at div
at Inner (https://frontend.local.domain.com/static/js/bundle.js:119623:24)
at PageSizeCalculator (https://frontend.local.domain.com/static/js/bundle.js:120014:25)
at DocumentLoader (https://frontend.local.domain.com/static/js/bundle.js:120182:25)
at div
at Viewer (https://frontend.local.domain.com/static/js/bundle.js:120363:25)
at div
at O (https://frontend.local.domain.com/static/js/bundle.js:356170:6)
at div
at O (https://frontend.local.domain.com/static/js/bundle.js:356170:6)
at div
at O (https://frontend.local.domain.com/static/js/bundle.js:356170:6)
at Reading (https://frontend.local.domain.com/static/js/bundle.js:30913:5)
at SegmentInteractive (https://frontend.local.domain.com/static/js/bundle.js:60576:5)
at div
at O (https://frontend.local.domain.com/static/js/bundle.js:356170:6)
at div
at O (https://frontend.local.domain.com/static/js/bundle.js:356170:6)
at div
at O (https://frontend.local.domain.com/static/js/bundle.js:356170:6)
at PlayerPage (https://frontend.local.domain.com/static/js/bundle.js:60670:69)
at div
at O (https://frontend.local.domain.com/static/js/bundle.js:356170:6)
at Page (https://frontend.local.domain.com/static/js/bundle.js:27760:5)
at RequireAuth (https://frontend.local.domain.com/static/js/bundle.js:31106:5)
at Routes (https://frontend.local.domain.com/static/js/bundle.js:321130:5)
at RoutesComponent
at LoadingProvider (https://frontend.local.domain.com/static/js/bundle.js:51678:80)
at ModalProvider (https://frontend.local.domain.com/static/js/bundle.js:51772:82)
at Worker (https://frontend.local.domain.com/static/js/bundle.js:120518:21)
at AppContainer (https://frontend.local.domain.com/static/js/bundle.js:9325:78)
at Router (https://frontend.local.domain.com/static/js/bundle.js:321063:15)
at BrowserRouter (https://frontend.local.domain.com/static/js/bundle.js:320543:5)
at Provider (https://frontend.local.domain.com/static/js/bundle.js:316834:20)
at ErrorBoundary (https://frontend.local.domain.com/static/js/bundle.js:141612:43)
at ErrorBoundary (https://frontend.local.domain.com/static/js/bundle.js:19039:5)
at Fe (https://frontend.local.domain.com/static/js/bundle.js:356081:60)
at FlagsProvider (https://frontend.local.domain.com/static/js/bundle.js:67889:5)
at Suspense
at AppProviders (https://frontend.local.domain.com/static/js/bundle.js:8739:5)
at div
at O (https://frontend.local.domain.com/static/js/bundle.js:356170:6)
at App
React will try to recreate this component tree from scratch using the error boundary you provided, ErrorBoundary.
Same error as well.
I'm also having the same issue on CRA v4
I don't see any issue when using the CRA starters:
- v4: https://github.com/react-pdf-viewer/starter/tree/main/create-react-app-v4
- v5: https://github.com/react-pdf-viewer/starter/tree/main/create-react-app
Can you create a CodeSandbox project for me?