-
Notifications
You must be signed in to change notification settings - Fork 124
Description
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.docxfile (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.