-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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: Effects are run on parents of suspending components #21510
Comments
For context, we ran into this with Relay - a |
Thanks for the report. This is similar to #14536 and #18141 Unfortunately, it is not possible to fix with
-- #18141 Note that "Blocking Mode" is no longer availabe in the latest experimental releases. |
Yeah, this is exactly the kind of thing that Concurrent Mode solves. We can't solve it outside of that because it would violate the constraints that non-CM-compatible code assumes. |
React 18 alpha with |
👍🏻 Thank you! |
With a component hierarchy like:
If the child throws to suspense, neither the parent nor child are in the DOM. However, the parents effects are still run. This breaks classes of layout effects, e.g. measuring text etc.
React version: 17.0.2
Steps To Reproduce
Link to code example: https://codesandbox.io/s/parent-effects-suspense-m2k4q?file=/src/App.tsx (see the console)
The current behavior
Effects are run on parent component even though it isn't in the DOM
The expected behavior
Effects are not run on the parent component until it is actually mounted
The text was updated successfully, but these errors were encountered: