react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

fix: resizing window causes 'ResizeObserver loop completed with undelivered notifications' error

Open reidbarber opened this issue 10 months ago โ€ข 11 comments

Closes https://github.com/adobe/react-spectrum/issues/7718

The error shown 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:

  • [ ] Included link to corresponding React Spectrum GitHub Issue.
  • [ ] Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • [ ] Filled out test instructions.
  • [ ] Updated documentation (if it already exists for this component).
  • [ ] Looked at the Accessibility Practices for this feature - Aria Practices

๐Ÿ“ Test Instructions:

  1. Open the RAC -> Popover Example story in it's own tab
  2. Open the console and resize your window rapidly to cause the popover position to be updated
  3. Verify that there is no ResizeObserver loop completed with undelivered notifications error in the console

๐Ÿงข Your Project:

reidbarber avatar Feb 07 '25 22:02 reidbarber

I did this a long time ago https://github.com/adobe/react-spectrum/pull/2891

Which we had to revert due to https://github.com/adobe/react-spectrum/pull/4204

We'll have to check if the issue that caused us to revert it happens in this PR as well. There isn't a lot of info on what it was, might be good to go back and check some of our testing sheets if you can.

snowystinger avatar Feb 10 '25 03:02 snowystinger

@snowystinger

Looked back and looks like tooltip positions were broken in chromatic, which led to https://github.com/adobe/react-spectrum/pull/4202#discussion_r1136624321, which we reverted because the original bug was reintroduced.

reidbarber avatar Feb 10 '25 18:02 reidbarber

@snowystinger not seeing anything noteworthy: https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=900

reidbarber avatar Feb 10 '25 23:02 reidbarber

@snowystinger not seeing anything noteworthy: https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=900

https://www.chromatic.com/test?appId=5f0dd5ad2b5fc10022a2e320&id=67aa8fee55d156ca20f02823 this one is new, it's not a flaky test

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 avatar Feb 11 '25 00:02 snowystinger

@snowystinger - How would we confirm that the chromatic snapshot is just wrong?

imkesin avatar May 10 '25 03:05 imkesin

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

snowystinger avatar May 10 '25 04:05 snowystinger

@reidbarber - Are you able to rebase this again? I'd like to see if that hits the same issue with ButtonGroup: horizontal.

imkesin avatar Jun 02 '25 18:06 imkesin

Build successful! ๐ŸŽ‰

rspbot avatar Jun 02 '25 19:06 rspbot

I'm not seeing the new build up on Chromatic.

imkesin avatar Jun 02 '25 20:06 imkesin

any updates on this, or known workarounds? we're starting to adopt react-aria-components internally and seeing this intermittently on things like the Menu component

atreidesend avatar Oct 03 '25 14:10 atreidesend