Skip to content

Fix Worker was terminated error on unmount#1877

Merged
wojtekmaj merged 3 commits into
wojtekmaj:mainfrom
andriivitiv:fix-error-on-unmount-if-loading-has-not-finished-yet
Sep 18, 2024
Merged

Fix Worker was terminated error on unmount#1877
wojtekmaj merged 3 commits into
wojtekmaj:mainfrom
andriivitiv:fix-error-on-unmount-if-loading-has-not-finished-yet

Conversation

@andriivitiv

Copy link
Copy Markdown
Contributor

Fixes #1062 - Worker was terminated error on document unmount if loading has not yet finished.

@wojtekmaj wojtekmaj merged commit 2ff8ff6 into wojtekmaj:main Sep 18, 2024
@wojtekmaj

Copy link
Copy Markdown
Owner

Thanks mate!


return () => {
loadingTask.destroy();
loadingPromise.finally(() => loadingTask.destroy());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduced a race condition when quickly switching to a new PDF file. The cleanup could run asynchronously after the new PDF started loading and cause a crash.

It's now fixed with PRs mozilla/pdf.js#20503, Expensify/react-fast-pdf#51, Expensify/react-fast-pdf#52, and Expensify/App#80160.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants