ContentPreview Resize Generates Many Uncaught Promise Rejections
noseworthy opened this issue · 3 comments
When resizing the ContentPreview
component in box-ui-elements
, the call to this.preview.resize();
can generate promises that get cancelled and that then throw errors when they're rejected. We use sentry
to monitor frontend errors in our app and whenever anyone resizes their bowser window we get hundreds of uncaught promise rejections from this component. I tried using an error boundary to catch the errors and silence them (since they're just cancelled resize tasks) but was unable to.
Environment:
- Elements version: 13.0.0
Desktop (please complete the following information):
- OS: MacOS 11.2.3
- Browser: Safari, Brave
- Version: Safari 14.0.3, Brave Version 1.22.72 Chromium: 89.0.4389.128 (Official Build) (x86_64)
Steps to reproduce the problem:
- Render a
<ContentPreview>
component with a.docx
file (though it doesn't seem to matter what file) - Resize the viewport either by dragging the window corners or dragging the development tools
- See many uncaught promise rejections happen:
Uncaught (in promise) Error: TextLayer task cancelled.
at B.cancel (pdf.min.js:482)
at f.value (pdf_viewer.min.js:62)
at e.value (pdf_viewer.min.js:138)
at e.value (pdf_viewer.min.js:134)
at e.value (pdf_viewer.min.js:138)
at e.value (pdf_viewer.min.js:172)
at e.value (pdf_viewer.min.js:175)
at e.set (pdf_viewer.min.js:190)
at n.value (preview.js:33)
at e.value (preview.js:58)
at Object.onResize (ContentPreview.js:849)
at index.esm.js:133
What is the expected behavior? (Screenshots can be helpful here)
The component resizes sucessfully without throwing errors in the console.
What went wrong? (Screenshots, console logs, or HAR files can be helpful here)
Nothing visually, just all these uncaught promise rejections trigger a lot of events in Sentry
Expected behavior
The component resizes sucessfully without throwing errors in the console.
Opening this up to replace box/box-ui-elements#2547
Hi @noseworthy. This is a known issue with the version of pdf.js that we use and was fixed by mozilla/pdf.js#10962. We're still evaluating our upgrade path, but don't have any immediate plans to upgrade just yet. Since the issue is not user-facing, we consider it to be fairly low priority. Hope that helps gives some context.
Hi @noseworthy. This is a known issue with the version of pdf.js that we use and was fixed by mozilla/pdf.js#10962. We're still evaluating our upgrade path, but don't have any immediate plans to upgrade just yet. Since the issue is not user-facing, we consider it to be fairly low priority. Hope that helps gives some context.
Thanks for the context and the quick reply! We'll try to figure out a way to exclude these from Sentry.