Skip to content

Error handling - PDFJS worker termination while loading and unmounting component.  #1062

@nicolasiscoding

Description

@nicolasiscoding

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

Sorry for the bump but is there any known solutions to this? This is referenced in this closed issue but seems as if the issue is stale and have a newer build then what is referenced here. It does not appear to be caught in the onLoadError.

#651

image

image

image

image

Steps to reproduce

  1. Throttle Network speed in browser
  2. Load a PDF
  3. Navigate to another page prior to the PDF completing forcing the component to unmount
  4. Get error in console

Expected behavior

Graceful error handling or the ability to do a try catch, or an abort controller equivalent.

Actual behavior

React is not happy

Additional information

I happen to be using Gatsby, but this should persist even in vanilla React environments

Environment

  • Browser (if applicable): Chrome Version 106.0.5249.103
  • React-PDF version: 5.7.2
  • React version: 16.14.0
  • Webpack version (if applicable): 5.74.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfreshhelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions