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

Material-UI: too many re-renders. The layout is unstable. #20106

Closed
2 tasks done
aryzing opened this issue Mar 13, 2020 · 10 comments
Closed
2 tasks done

Material-UI: too many re-renders. The layout is unstable. #20106

aryzing opened this issue Mar 13, 2020 · 10 comments
Labels
bug 🐛 Something doesn't work component: TextareaAutosize The React component.

Comments

@aryzing
Copy link

aryzing commented Mar 13, 2020

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

When typing a large input into a <TextField>, eventually the following error pops up in the console

Material-UI: too many re-renders. The layout is unstable.
TextareaAutosize limits the number of renders to prevent an infinite loop.

Expected Behavior 🤔

For this to not happen

Steps to Reproduce 🕹

Just type a lot into the <TextField>.

Context 🔦

Just trying to write a long input into <TextField>.

Your Environment 🌎

Tech Version
Material-UI v4.9.5
React 16.13.0
Browser Firefox 74
TypeScript 3.8.3
@oliviertassinari oliviertassinari added the status: waiting for author Issue with insufficient information label Mar 13, 2020
@oliviertassinari
Copy link
Member

Please provide a full reproduction test case. This would help a lot 👷 .
A live example would be perfect. This codesandbox.io template may be a good starting point. Thank you!

@oliviertassinari oliviertassinari added the component: TextareaAutosize The React component. label Mar 15, 2020
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work and removed status: waiting for author Issue with insufficient information labels Apr 15, 2020
@Sharealikelicence
Copy link

For anyone else that comes across this issue while searching for a solution to the above error, it could be that you are passing in event handlers like this:
<TextField onInput={handleOnInput} value={someValue} />
Try changing them to this:
<TextField onInput={(e) => handleOnInput(e)} value={someValue} />

@Jimbob001

This comment was marked as off-topic.

@azouaoui-med

This comment was marked as off-topic.

@commoddity

This comment was marked as off-topic.

@marckornberger

This comment was marked as off-topic.

@marckornberger

This comment was marked as outdated.

@AndyFang36

This comment was marked as outdated.

@aeharding

This comment was marked as outdated.

@mui mui locked as resolved and limited conversation to collaborators Jun 1, 2022
@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 1, 2022

It's to be noted that there is a regression in React 18 compared to React 17. Compare:

React 17.0.2: https://codesandbox.io/s/multilinetextfields-demo-material-ui-forked-nux4ft?file=/index.tsx
React 18.1.0: https://codesandbox.io/s/multilinetextfields-demo-material-ui-forked-2q078p?file=/index.tsx

Something prevents the height to be correct. I have locked this issue so we don't mix two different problems (having the same warning symptoms). This #20106 issue is about finding CSS/DOM cases that lead to a wrong layout computation, not a React 18 regression. Opening a new issue for the latter problem would be great.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🐛 Something doesn't work component: TextareaAutosize The React component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants