Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContentPreview Resize Generates Many Uncaught Promise Rejections #1362

Open
noseworthy opened this issue Apr 23, 2021 · 3 comments
Open

ContentPreview Resize Generates Many Uncaught Promise Rejections #1362

noseworthy opened this issue Apr 23, 2021 · 3 comments

Comments

@noseworthy
Copy link

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:

  1. Render a <ContentPreview> component with a .docx file (though it doesn't seem to matter what file)
  2. Resize the viewport either by dragging the window corners or dragging the development tools
  3. 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.

@noseworthy
Copy link
Author

Opening this up to replace box/box-ui-elements#2547

@jstoffan
Copy link
Collaborator

jstoffan commented Apr 23, 2021

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.

@noseworthy
Copy link
Author

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.

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

No branches or pull requests

2 participants