Skip to content
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

[data grid] Error: Uncaught ResizeObserver loop completed with undelivered notifications => when opening a new window (about:blank) #16277

Closed
danciudev opened this issue Jan 20, 2025 · 10 comments · May be fixed by #16284
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Rendering layout Related to the data grid Rendering engine

Comments

@danciudev
Copy link

danciudev commented Jan 20, 2025

Steps to reproduce

Hi guys, I am a user of MUI Data Grid Premium, I detected the following error:

Steps:

  1. Open this link to live example: (required) https://codesandbox.io/p/sandbox/stoic-bassi-f4fckg
  2. Click in open window
  3. Close the new window
  4. Inspect in the console

Current behavior

Infinite loop showing error message ‘Uncaught ResizeObserver loop completed with undelivered notifications’.

Expected behavior

No error.

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: ResizeObserver, about:blank, new window

@danciudev danciudev added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 20, 2025
@github-actions github-actions bot added the component: data grid This is the name of the generic UI component, not the React module! label Jan 20, 2025
@lauri865
Copy link
Contributor

lauri865 commented Jan 20, 2025

Interesting use case. You should unmount the component when closing the window (unrelated to data grid):
https://codesandbox.io/p/sandbox/fervent-bessie-rn3h8m?file=%2Fsrc%2Fuse-open-window.tsx

You can also delay rendering to avoid the remaining errors, as a new popup has no dimensions initially. But that's not really an issue.

@danciudev
Copy link
Author

Sorry I got the wrong version of React in the codesanbox, with react version 18 the error still appears. My temporary solution is to go back to version ‘@mui/x-data-grid-premium’: ‘7.22.3’, and update the create window hook.

As for delaying the rendering, it could also be a valid solution, but it seemed to work in the previous version of the library, so I guess it is a bug with the new react 19 changes.

@michelengelen
Copy link
Member

Whats interesting and weird: If you add a second function call to the unmount it does work. Noticed because I wanted to log something to the console, so that alone is enough to make the error disappear. Not sure why that is though. This couldn't be because the log is pushed onto the stack, no?

@lauri865
Copy link
Contributor

Sorry I got the wrong version of React in the codesanbox, with react version 18 the error still appears. My temporary solution is to go back to version ‘@mui/x-data-grid-premium’: ‘7.22.3’, and update the create window hook.

Which error? Can you provide a reproduction?

@danciudev
Copy link
Author

Update draft with react and react dom version 18.

Click in open window
Close the new window
Inspect in the console
Infinite loop error

https://codesandbox.io/p/sandbox/stoic-bassi-f4fckg

@lauri865
Copy link
Contributor

Update draft with react and react dom version 18.

Click in open window Close the new window Inspect in the console Infinite loop error

https://codesandbox.io/p/sandbox/stoic-bassi-f4fckg

I cannot seem to reproduce the infinite loop error. I only see a The parent DOM element of the Data Grid has an empty width. error (which is more a warning than an error).

@michelengelen
Copy link
Member

michelengelen commented Jan 21, 2025

I could reproduce it with React 18, so the issue is indeed present, but as stated it goes away with a second function being called before the root.unmount call

I guess wrapping in a setTimeout( ... , 0) would work as well. Could you check that @danciudev ?

@michelengelen michelengelen changed the title Error: Uncaught ResizeObserver loop completed with undelivered notifications => when opening a new window (about:blank) [data grid Error: Uncaught ResizeObserver loop completed with undelivered notifications => when opening a new window (about:blank) Jan 21, 2025
@michelengelen michelengelen added status: waiting for author Issue with insufficient information feature: Rendering layout Related to the data grid Rendering engine and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 21, 2025
@michelengelen michelengelen changed the title [data grid Error: Uncaught ResizeObserver loop completed with undelivered notifications => when opening a new window (about:blank) [data grid] Error: Uncaught ResizeObserver loop completed with undelivered notifications => when opening a new window (about:blank) Jan 21, 2025
@lauri865
Copy link
Contributor

lauri865 commented Jan 21, 2025

The above PR should fix it. The problem might be particular to dev mode though, as it happens intermittently, but still.

You still need to call unmount though, as otherwise you're continuing to render the component even after the popup window closes, as the rendering is handled by the parent window – stripped down example / reproduction without any data grid:
https://codesandbox.io/p/sandbox/polished-sun-lcyy8r

@danciudev
Copy link
Author

Perfect, thanks

@github-actions github-actions bot removed the status: waiting for author Issue with insufficient information label Jan 22, 2025
Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@danciudev How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Rendering layout Related to the data grid Rendering engine
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants