-
Notifications
You must be signed in to change notification settings - Fork 49.7k
[DevTools] Consume SuspenseNodes that were skipped when we're bailing out of a subtree #34082
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
Merged
sebmarkbage
merged 4 commits into
facebook:main
from
sebmarkbage:fixreconciliationofsuspensenodes
Aug 4, 2025
Merged
[DevTools] Consume SuspenseNodes that were skipped when we're bailing out of a subtree #34082
sebmarkbage
merged 4 commits into
facebook:main
from
sebmarkbage:fixreconciliationofsuspensenodes
Aug 4, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffde66a to
35b1481
Compare
eps1lon
reviewed
Aug 4, 2025
Comment on lines
+3995
to
+4002
| if (fiberInstance.suspenseNode !== null) { | ||
| reconcilingParentSuspenseNode = stashedSuspenseParent; | ||
| previouslyReconciledSiblingSuspenseNode = stashedSuspensePrevious; | ||
| remainingReconcilingChildrenSuspenseNodes = stashedSuspenseRemaining; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think unmountFiberRecursively in https://github.com/sebmarkbage/react/blob/35b14817c6ee519cd3ac4ddaf7c205cd9f2b964c/packages/react-devtools-shared/src/backend/fiber/renderer.js#L3166-L3168 is also missing the conditional restore.
eps1lon
approved these changes
Aug 4, 2025
35b1481 to
4b8e0b0
Compare
sebmarkbage
added a commit
to sebmarkbage/react
that referenced
this pull request
Aug 4, 2025
… out of a subtree (facebook#34082) This searches through the remaining children to see if any of them were children of the bailed out FiberInstance and if so we should reuse them in the new set. It's faster to do this than search through children of the FiberInstance for Suspense boundaries.
sebmarkbage
added a commit
that referenced
this pull request
Aug 6, 2025
…nstead of Unmounting and Mounting (#34089) Stacked on #34082. This keeps the DevToolsInstance children alive inside Offscreen trees while they're hidden. However, they're sent as unmounted to the front end store. This allows DevTools state to be preserved between these two states. Such as it keeps the "suspended by" set on the SuspenseNode alive since the children are still mounted. So now you when you resuspend, you can see what in the children was suspended. This is useful when you're simulating a suspense but can also be a bit misleading when something suspended for real since it'll only show the previous suspended set and not what is currently suspending it since that hasn't committed yet. SuspenseNodes inside resuspended trees are now kept alive too. That way they can contribute to the timeline even when resuspended. We can choose whether to keep them visible in the rects while hidden or not. In the future we'll also need to add more special cases around Activity. Because right now if SuspenseNodes are kept alive in the Suspense tab UI while hidden, then they're also alive inside Activity that are hidden which maybe we don't want. Maybe simplest would be that they both disappear from the Suspense tab UI but can be considered for the timeline. Another case is that when Activity goes hidden, Fiber will no longer cause its content to suspend the parent but that's not modeled here. So hidden Activity will show up as "suspended by" in a parent Suspense. When they disconnect, they should really be removed from the "suspended by" set of the parent (and perhaps be shown only on the Activity boundary itself).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This searches through the remaining children to see if any of them were children of the bailed out FiberInstance and if so we should reuse them in the new set. It's faster to do this than search through children of the FiberInstance for Suspense boundaries.