ResizeObserver loop limit exceeded
See original GitHub issue👋 Hello. We have a component that’s using this hook with in it’s default form (no custom callback) and have been getting a lot of ResizeObserver loop limit exceeded
errors thrown during usage.
From my brief search around the internet it seems as though this is harmless but it does add a lot of noise in common usage and that that noise could be avoided by wrapping the ResizeObserver callback in a requestAnimationFrame
.
I could adjust our usage to do this using a custom callback, but that would mean reimplementing the core observer logic which seems rather pointless. Does it make sense as a core adjustment?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:6 (4 by maintainers)
Top Results From Across the Web
ResizeObserver - loop limit exceeded - Stack Overflow
This error means that ResizeObserver was not able to deliver all observations within a single animation frame. It is benign (your site will...
Read more >Error: ResizeObserver loop limit exceeded · Issue #5440
Resizing window triggers Error: ResizeObserver loop limit exceeded . The error is not logged in browser's console, but Sentry captures it.
Read more >Uncaught exception: ResizeObserver loop limit exceeded
This is a legitimate problem, and the runtime error is in the console code. Regardless of what's in the CSV, the console should...
Read more >ResizeObserver loop limit exceeded - Perspective - Ignition
I'm having a performance issue with perspective. The problem happens in a table component. I have two Arrays Object with 36 keys:values each ......
Read more >Every time when I edit something in Tableau online, it ...
Every time when I edit something in Tableau online, it occurres an unexpected error. "ResizeObserver loop limit exceeded." Anyone knows how to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah having a rAF call in there would mean that you no longer get notification of resize events as they happen, but rather with a 16ms delay or so. (Depending where you are in the current tick.)
If you need rAF, then it should be really easy to have a custom local hook, that does something like:
In terms of such optimisations (like throttle and debounce) it’s not as easy to know exactly what people might need, and as you’d pile more feature on top, the harder it would be to maintain this lib, which is meant to be as low-level as it can. 🤷♂️
It is a good candidate for a readme entry or a codesandbox demo. (Like the ones I’ve made for throttle and debounce.)
Sorry, @ZeeCoder — I’m not that familiar with the ResizeObserver API or its usage in practice and so my reading of https://stackoverflow.com/a/50387233 was that that exception is usually caused not necessarily by an infinite loop, but by the observer triggering more events than can be handled in a frame.
What I was musing on as a solution was wrapping the
observe
callback in arequestAnimationFrame
to ensure that it only passes events at a rate that’s actually usable in a consuming app. I imagine that could cause issues with an initial evaluation of their values though so it probably doesn’t make sense after all (and that suggestion was predicated on that SO comment being accurate anyway).