fix: resizing window causes 'ResizeObserver loop completed with undelivered notifications' error#7742
Conversation
…ror when overlays get resized
|
Looked back and looks like tooltip positions were broken in chromatic, which led to #4202 (comment), which we reverted because the original bug was reintroduced. |
|
@snowystinger not seeing anything noteworthy: https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=900 |
https://www.chromatic.com/test?appId=5f0dd5ad2b5fc10022a2e320&id=67aa8fee55d156ca20f02823 That said, it looks like the chromatic snapshot has been wrong, it shouldn't have been stacked vertically all this time. Let's see if we can find out more about what has happened there |
|
@snowystinger - How would we confirm that the chromatic snapshot is just wrong? |
|
The name of the chromatic test is ButtonGroup: horizontal, but it was previously rendering it vertically, so it was definitely consistently wrong. I'm not sure when it changed, we can probably look back at previous snapshots and the commits they are associated with |
|
@reidbarber - Are you able to rebase this again? I'd like to see if that hits the same issue with |
|
Build successful! 🎉 |
|
I'm not seeing the new build up on Chromatic. |
|
any updates on this, or known workarounds? we're starting to adopt react-aria-components internally and seeing this intermittently on things like the |
|
Build successful! 🎉 |
devongovett
left a comment
There was a problem hiding this comment.
Approving for testing. We may want to make this more granular though, e.g. moving the raf into the individual components that use resize observer instead of applying it globally. In theory, only the components that cause synchronous DOM updates to the target of the resize observer as a result of a resize event are affected by this, so we only need to delay those. One other downside to this is that it delays updates by 1 frame, so it could result in flickering potentially. But lets test this carefully first and see if we notice any regressions.
Closes #7718
The error is likely due to how DOM changes triggered by the resize observer cause further resize events in the same frame. We can mitigate this by waiting until the next frame to apply the updates. This one may need a decent amount of manual regression testing.
✅ Pull Request Checklist:
📝 Test Instructions:
ResizeObserver loop completed with undelivered notificationserror in the console🧢 Your Project: