-
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
Use Passive flag to schedule onPostCommit #19862
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
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.
What does this comment mean?
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.
Roughly this (typed it out fast, might be a mistake)
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.
Happy to pick this TODO up if you haven't already started on it. Let me know.
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.
Circling back on this.
It's possible that I'm misunderstanding what you're suggesting, but I think the pseudo-code solution is missing a few things.
There are two places we walk the return path to find the nearest Profiler ancestor:
commitLifeCycles
to bubble up layout effect durations from one Profiler to the next.commitProfilerPassiveEffect
to bubble up passive effect durations from one Profiler to the next.Neither of these functions are recursive. The work loop functions that call them are (e.g.
commitLayoutEffects
andflushPassiveMountEffects
) so maybe that's what you meant to show instead with the above pseudo-code example?There's another snag though. These durations bubble up one Profiler at a time. The "TODO" code in question is just bubbling the durations from the current Profiler to the next nearest (ancestor) Profiler. If we used a stack for this, the top of the stack would always just point to the current Profiler (which we already have, since its the current Fiber we're working on). So we'd need to maintain pointers to the top two Profilers in the stack.
This could work, but it's not as clean an implementation as you were perhaps thinking? I'll post a PR.
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.
#19895
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.
Yeah
commitWork
in my example is meant to correspond tocommitLayoutEffects
et alThere 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.
Gotcha.
The naming of
commitWork
confused the heck out of me then, given where the TODO comments were previously (inReactFiberCommitWork
- which also has a function calledcommitWork
)