-
-
Notifications
You must be signed in to change notification settings - Fork 985
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Before 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 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):
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working