-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[TextareaAutosize] ResizeObserver loop completed with undelivered notifications (when resizing view with TextArea with scroll inside) #43718
Comments
This comment was marked as resolved.
This comment was marked as resolved.
I have the same issue, when I add 'multiline' property to TextField. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Reopening this since we're getting more reports that seem to be related. Can anyone share a reproduction of the problem? |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I was facing the same error, and also had I was unable to reproduce the error on CodePen, but hopefully this helps others! |
I can also confirm that using the I am using:
It's worth noting that the warning appears occasionally on page refresh (about 80% of the times). @ryan-saffer adding |
I could at least isolate the problem. In my case, it was lying into the main mustache template. This is a simplified version that I hope it helps you to reproduce the issue:
The warning stops appearing if I comment out the line
This is the client code, reduced to the minimum:
|
I also face this error. I use |
I am also encountering this issue. It seems like this error is already being handled in the test environment, so we may need to apply the error handling here in TextareaAutosize.tsx to all environments. |
I have exactly the same issue with MUI 5.14.11! The only thing I can add, it only happens when the breakpoint SM (600px width) is passed! |
I'm having the same issue. Actually the whole code needed to reproduce this issue is just:
Then put some long text in it and an error will appear whenever number of lines changes due to window resizing. Codesandbox to reproduce: It happens only when the whole window resizes, so it doesn't work on codesandbox and webpack gives us a nasty red overlay with this error but in this example, I attached to the |
This comment was marked as duplicate.
This comment was marked as duplicate.
Similar issue to this for me. If I add the maxRows prop, then the error no longer appears. |
I've been having the same issue, but with the
|
This comment was marked as duplicate.
This comment was marked as duplicate.
The last version of MUI where it works as it should is @mui/[email protected] There is nothing really too specific in our use case - standard MUI layout with Papers, Drawer, Tabs. |
Interestingly enough, I still get the error in @mui/[email protected] when using the multiline box in a tab. When refresh the page, it doesn't happen, but when I switch to a different MUI tab and then back to the one with the textbox, the error appears. Like you, there's nothing that strange about my use case. It's entirely standard MUI components. |
Can someone provide live examples on CodeSandbox or StackBlitz? I can reproduce the issue with Joy UI Textarea (CodeSandbox) as shown here. It would help if we get separate reproductions for Base UI TextareaAutosize and Material UI TextField with the This issue was moved from the However, for the Material UI TextField with the --- a/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx
+++ b/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx
@@ -144,10 +144,7 @@ const TextareaAutosize = React.forwardRef(function TextareaAutosize(
const handleResize = () => {
syncHeight();
};
- // Workaround a "ResizeObserver loop completed with undelivered notifications" error
- // in test.
- // Note that we might need to use this logic in production per https://github.com/WICG/resize-observer/issues/38
- // Also see https://github.com/mui/mui-x/issues/8733
+ // Workaround a "ResizeObserver loop completed with undelivered notifications" error.
let rAF: any;
const rAFHandleResize = () => {
cancelAnimationFrame(rAF);
@@ -164,9 +161,7 @@ const TextareaAutosize = React.forwardRef(function TextareaAutosize(
let resizeObserver: ResizeObserver;
if (typeof ResizeObserver !== 'undefined') {
- resizeObserver = new ResizeObserver(
- process.env.NODE_ENV === 'test' ? rAFHandleResize : handleResize,
- );
+ resizeObserver = new ResizeObserver(rAFHandleResize);
resizeObserver.observe(input);
} I'm not entirely sure if this will fix the issue, so I'm requesting live reproductions first to test this change. |
Thanks buddy, this works as of now. |
Implemented api call to get real notes from api. Implemented a useFetch hook to reuse. Left a few TODOs as this took a while to get working and exceeded my time box MUI seems to have an issue with the textField causing a resize observer error when multilines is used. https://github.com/mui/base-ui/issues/167 Downgraded mui to a version where this isn't an issue
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
This may not be the best solution and it won't solve the problem for everyone. But in my case this occurs when the width of the text field is less than 300px. (I didn't deep dive to find the root cause). So adding |
Having the same issue. Mine specifically is occurring when I have a My workaround is as follows:
So the text area is initially rendered without multiline, as soon as the component is mounted, the multiline property is toggled to true. This use case works for me, but understand it might not work for others. |
This comment was marked as outdated.
This comment was marked as outdated.
This worked for me! Thanks! |
Can anyone share a reproduction with Material UI? If you can't do it in CodeSandbox, feel free to create a GH repo with it. I tried it myself locally but I am not able to reproduce it. |
@mnajdova |
This comment was marked as duplicate.
This comment was marked as duplicate.
Best workaround I think. Thanks! |
This solution with the
|
I've opened a PR with a potential fix, here's a demo sandbox which is forked from the latest repro in this comment In the mean time, if you are affected by this issue you can try this fix locally by updating the versions in your "dependencies": {
"@mui/material": "https://pkg.csb.dev/mui/material-ui/commit/b5719465/@mui/material",
"@mui/system": "https://pkg.csb.dev/mui/material-ui/commit/b5719465/@mui/system"
} |
Steps to reproduce 🕹
Link to live example:
https://codesandbox.io/p/sandbox/mui-resizeobserver-loop-error-d2w936
Steps:
Current behavior 😯
All seems to works fine at first view but sentry report a "ResizeObserver loop completed with undelivered notifications." error.
Expected behavior 🤔
No error should occur
Context 🔦
No response
Your environment 🌎
Search keywords:
Search keywords:
The text was updated successfully, but these errors were encountered: