-
Notifications
You must be signed in to change notification settings - Fork 47k
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: False positive warning with nested roots: Attempted to synchronously unmount a root while React was already rendering. #25675
Comments
Smaller repro: https://codesandbox.io/s/react-18-sync-root-unmount-in-ref-callback-sgcy0e In short: Triggers a warning if you unmount a root in a ref callback. Also getting the warning of the state update is caused by a non-discrete event. Note that So seems intended that you use |
do we have any updates on this issue? i am using MFE architecture with module federation, I have same warning when I am calling unmount method while removing the MFE |
I'm also facing the same issue. It's not obvious to unmount within |
… before the current render task finished. See facebook/react#25675
any updates on this? experiencing the same issue when I call Legit use case where I have a parent react root add a web component as as ref child and that web component in turn has its own react root, hence the nested react roots. |
we get a warning on (legitimate?) use case, if there is a manually added react root inside another parent root
(for example for part of Backbone view that is inserted into parent react component)
on unmount we can see that child root is in commit context, so we cant unmount it
React version: 18.2
Steps To Reproduce
I have 2 way bindings for backbone.marionette and react
when root/parent component gets rendered/destroyed React gives this warning
I am looking for ways to fix this warning
I think ReactChild node is somehow marked as
toBeRendered
at the app render, even though I would expect that app.root would not know about nested/inserted MView react rootLink to code example: https://codesandbox.io/s/my-test-adapters-forked-tdbgdb
problematic code
The current behavior
warning is displayed
The expected behavior
no warning ?
The text was updated successfully, but these errors were encountered: