-
Notifications
You must be signed in to change notification settings - Fork 48.2k
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
Bug: Maximum update depth exceeded #32714
Comments
Everytime the setState runs the component is |
@Harikrishnaselvam No, this is a false positive error. The effect is only running once, and it was introduced recently, probably with the devtools update. We're also experiencing the same calling setState in a requestAnimationFrame, and we do need all those setState calls to update the UI. Could be done differently? Yes, but that won't change the fact that the error is a false positive that wasn't an error before. |
In my case this is something specific to rendering being expensive enough that it somehow confuses itself into thinking that there's recursion going on. In my real case, I have a somewhat complex component that's updated on every frame (sorry, I need the animation), and one of its parts uses setEffect for a simple operation. |
Out of curiosity, as my team experienced something similar recently - what happens if you replace your |
React erroneously complains about setState calls when the application is doing enough work to keep the browser busy between updates.
React version: 18 & 19
Steps To Reproduce
The current behavior
After a few seconds starts repeatedly printing this in console:
Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.
The expected behavior
There is no invalid useState calls as far as I'm aware?
The text was updated successfully, but these errors were encountered: