react-cool-dimensions: ResizeObserver loop limit exceeded
Ever since that we started using react-cool-dimensions that we’ve been having a lot of logged errors:
ResizeObserver loop limit exceeded
Based on this StackOverflow answer it’s not really something to worry about, however, it can be improved by wrapping the ResizeObserver updates in a requestAnimationFrame.
Here’s an example of how a similar library (not a hook) solved this.
Do you think we can get such an improvement into react-cool-dimensions?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 24 (23 by maintainers)
We have logs from the latest browser versions, so I don’t think this only happens on old versions.
In my opinion, yes.
Everyone that uses this library with some logging service (like Sentry) will probably come across this “issue”. And I say “issue” because it’s not really affecting functionality (as far as we know), but we have around 34k events affecting 18k users on this “issue” alone. We could ignore it on our system, but based on the links I posted above, this should be easily fixable.
I understand that without reproducing it, it’s hard to understand if we are actually fixing anything. And I can’t reproduce it myself either, so the best I could do is try to deploy a version with a similar fix to the ones mentioned above, and see if the logs start to go away.
Yes I did, @wellyshen, thanks for catching that 😅
Just updated our internal PR 😊
@rfgamaral For our case, we don’t need to use the ref, it costs more bundle size.
FYI, this is the patch I’m going to apply on our side:
I’ll report back a few days after deploying this to production, and if it works, I’ll open a PR with the fix 😃
@rfgamaral Sorry I’m busying for a new library, will reproduce it tomorrow XD