-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
[Fiber] Unify Hook Unmounting into ReactFiberCommitEffects #30979
Closed
Conversation
This file contains 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
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
facebook-github-bot
added
CLA Signed
React Core Team
Opened by a member of the React Core Team
labels
Sep 16, 2024
sebmarkbage
commented
Sep 16, 2024
} | ||
} | ||
if ( | ||
enableHiddenSubtreeInsertionEffectCleanup || |
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.
Now this flag is a bit simpler.
sebmarkbage
added a commit
that referenced
this pull request
Sep 17, 2024
…ct Duration in Module Scope (#30981) Stacked on #30979. The problem with the previous approach is that it recursively walked the tree up to propagate the resulting time from recording a layout effect. Instead, we keep a running count of the effect duration on the module scope. Then we reset it when entering a nested Profiler and then we add its elapsed count when we exit the Profiler. This also fixes a bug where we weren't previously including unmount times for some detached trees since they couldn't bubble up to find the profiler.
github-actions bot
pushed a commit
that referenced
this pull request
Sep 17, 2024
…ct Duration in Module Scope (#30981) Stacked on #30979. The problem with the previous approach is that it recursively walked the tree up to propagate the resulting time from recording a layout effect. Instead, we keep a running count of the effect duration on the module scope. Then we reset it when entering a nested Profiler and then we add its elapsed count when we exit the Profiler. This also fixes a bug where we weren't previously including unmount times for some detached trees since they couldn't bubble up to find the profiler. DiffTrain build for commit 4549be0.
github-actions bot
pushed a commit
that referenced
this pull request
Sep 17, 2024
…ct Duration in Module Scope (#30981) Stacked on #30979. The problem with the previous approach is that it recursively walked the tree up to propagate the resulting time from recording a layout effect. Instead, we keep a running count of the effect duration on the module scope. Then we reset it when entering a nested Profiler and then we add its elapsed count when we exit the Profiler. This also fixes a bug where we weren't previously including unmount times for some detached trees since they couldn't bubble up to find the profiler. DiffTrain build for [4549be0](4549be0)
sebmarkbage
force-pushed
the
moveprofiling
branch
from
September 17, 2024 19:32
f5775d7
to
e5c5f48
Compare
Landed by #30981. |
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 moves the recording wrapper around
commitHookEffectListUnmount
into acommitHookLayoutUnmountEffects
helper in ReactFiberCommitEffects so that all layout effect recording moves in there. This was already how mounts worked with thecommitHookLayoutMountEffects
helper.The main thing here is that I now use this helper in the deletion code a Fiber that has Hooks that need to unmount. This code doesn't need to be forked instead we can all the unmounting code once for insertion effects and once for layout effects. That way the code can be unified.
The main behavior change here is that all insertion effects of a Hook unmount first and then all layout effects. That's fix to the behavior because that's how the mount and update phases already work and that's consistent with how we treat other unmounts in separate phases. The downside is perhaps that we have to loop over the list of Hooks even though most likely there won't be any insertion effects in that list. That's what we already do for updates and mounts though.