-
Notifications
You must be signed in to change notification settings - Fork 682
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
[resize-observer] Should "resize loop error notification" be a warning instead of an error? #5488
Comments
We've started getting this error (and the Firefox equivalent: The only thing I can think of is that browser extensions are allowed to create ResizeObservers for elements on our page. If this is the case then the current behaviour of throwing an uncaught error to our error handler is utterly broken and needs fixing ASAP. |
The CSS Working Group just discussed The full IRC log of that discussion<dael> Topic: [resize-observer] Should "resize loop error notification" be a warning instead of an error?<dael> github: https://github.com//issues/5488 <dael> fantasai: I didn't know what to do but seems like we should do something <dael> Rossen_: Anyone had a chance to look at this and propose behavior or take a stance on warning vs error? <dael> iank_: Not sure downgrading completely to warning is correct. I have heard webdev uncover real bugs in production. Requires thought <dael> iank_: I think this requires a little bit of thought about how to approach this <dael> Rossen_: Let's continue in the issue then <dael> Rossen_: Once you're ready tag it again and we'll look |
Hi. I've been working with the ResizeObserver for some time now trying to write some web components. I've ran into a few problems using it and I'm going to try and use this time to decompose what those are and where I think there is room for improvement. It makes perfect sense to report this but probably not as a silent error that cannot be captured by the runtime; this seemingly breaks the model that developers are used to. There are a few problematic reasons for this and I will try and enumerate them here:
Over and over, you can find comments like this WICG/resize-observer#38 (comment) that state the "error is benign" or the most upvoted StackOverflow answer, https://stackoverflow.com/a/50387233. There are a ton of folks here as well WICG/resize-observer#38 (comment) and many commits mentioning that they are simply filtering it out from Sentry. Or others: WICG/resize-observer#38 (comment) Lately, there are a ton of of these coming through even more recently:
There are a ton more, check out all the linked things from here: WICG/resize-observer#38 This isn't the hallmark of a good API and it's not what we want to encourage developers to do. ... if the world just decides to ignore the error then it isn't an error at all anymore. To make matters worse, Firefox has a different string so the entire world can't even deny-list a single message. You can see that some folks are simply coming up the "creative" solutions to fix this: DevExpress/testcafe#4857 (comment) Many folks simply ignore it via RAF / setTimeout by queueing a microtask / microtask but this defeats the purpose -- since you don't get synchronous rendering! For example, see petyosi/react-virtuoso@5475a10 The tldr is;
I think there is a legitmate use case for these solutions when done right -- so I will open a seperate proposal to fix this. How to fix it? Chrome has the notion of violations, though I don't know if they are a web standard: https://umaar.com/dev-tips/192-console-violations/. I think something like that, though, is more well suited. This is not captured by things like Sentry, Bugsnag, and the ilk, and it's verbose enough that it would let you determine performance regressions. Can we talk about this a bit more? |
The spec says
which seems like the intent is for this to be a warning, because behavior is not to halt a program, but to advise that remaining resize observations will be fired in the next loop.
In Chrome the message is
ResizeObserver loop limit exceeded
. Valid error handling code (as a search for this on GitHub shows) gets caught up by this error and programs are unintentionally halted for what seems like a warning.As an example (at time of writing this), https://lume.io/docs/#/examples/shadow-dom shows that this error can cause unexpected termination of a program (downside the window to trigger termination of the program in on the right of the code box).
Here are some GitHub issues showing users having issues with termination by 3rd libraries due to this "error": https://www.google.com/search?q=site%3Agithub.com%20ResizeObserver%20loop%20limit%20exceeded&cad=h
I think perhaps treating this as a warning might be a better deal; perhaps "resize loop warning notification".
The text was updated successfully, but these errors were encountered: