Skip to content

Commit

Permalink
Merge pull request #48196 from CyberAndrii/47810-Worker-was-terminate…
Browse files Browse the repository at this point in the history
…d-console-error-when-closing-a-PDF

Fix "Worker was terminated" console error when closing a PDF before it finishes loading
  • Loading branch information
thienlnam authored Aug 28, 2024
2 parents 283ee54 + 5ae9e76 commit 41cf903
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions patches/react-pdf+7.7.3.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
diff --git a/node_modules/react-pdf/dist/cjs/Document.js b/node_modules/react-pdf/dist/cjs/Document.js
index 9bb0398..032d898 100644
--- a/node_modules/react-pdf/dist/cjs/Document.js
+++ b/node_modules/react-pdf/dist/cjs/Document.js
@@ -289,6 +289,7 @@ const Document = (0, react_1.forwardRef)(function Document(_a, ref) {
pdfDispatch({ type: 'REJECT', error });
});
return () => {
+ loadingTask._worker.destroy();
loadingTask.destroy();
};
}
diff --git a/node_modules/react-pdf/dist/esm/Document.js b/node_modules/react-pdf/dist/esm/Document.js
index b1c5a81..569769e 100644
--- a/node_modules/react-pdf/dist/esm/Document.js
Expand Down

0 comments on commit 41cf903

Please sign in to comment.