Before you start - checklist
Description
I have a problem in my Next.js app. Whenever a document fails to load with an error, for example 403 or 404, my whole UI crashes. Even though I have the error handlers.
<Document
file={url}
onLoadSuccess={onDocumentLoadSuccess}
onLoadError={() => onFileLoadError?.()}
options={options}
externalLinkTarget="_blank"
loading={<div className="text-center p-4">Loading PDF...</div>}
error={<div>ERROR</div>}
>
{numPages && (
<Page
key={`page_${currentPage}`}
pageNumber={currentPage}
renderAnnotationLayer={false}
renderTextLayer={true}
scale={scale}
/>
)}
</Document>
Steps to reproduce
- import Document,
- assign loading url with error
- click preview
Expected behavior
I expect just to show to users error component.
Actual behavior
Whole application crashes.
Additional information
No response
Environment
- Browser (if applicable):
- React-PDF version:
- React version:
- Bundler name and version (if applicable):
Before you start - checklist
Description
I have a problem in my Next.js app. Whenever a document fails to load with an error, for example 403 or 404, my whole UI crashes. Even though I have the error handlers.
Steps to reproduce
Expected behavior
I expect just to show to users error component.
Actual behavior
Whole application crashes.
Additional information
No response
Environment