web: stop reporting the `ResizeObserver loop limit exceeded` error to Sentry
Created by: valerybugakov
Context
The ResizeObserver loop limit
error means that ResizeObserver
was not able to deliver all observations within a single animation frame. It doesn't break the functionality of the application. The W3C considers converting this error to a warning: https://github.com/w3c/csswg-drafts/issues/5023. We can safely ignore it in the production environment to avoid hammering Sentry and other libraries relying on window.addEventListener('error', callback)
.
And we need to ignore it because it eats up our Sentry quota quickly.:
Changes
- Catch the
ResizeObserver loop limit
error to prevent it from going to the Sentry. - Move the
ResizeObserver
callback into RAF to prevent errors from happening.- Note: this doesn't prevent all
ResizeObserver loop limit
errors. Some third-party libraries use it without RAF; that's why catching the error in production is necessary.
- Note: this doesn't prevent all