Move passive logic out of layout phase#19500
Merged
acdlite merged 3 commits intoJul 31, 2020
Merged
Conversation
Part of the code in flushPassiveUnmountEffects is a duplicate of the code used for unmounting layout effects. I did some minor refactoring to so we could use the same function in both places. Closure will inline anyway so it doesn't affect code size or performance, just maintainability.
We don't need to check HookHasEffect during a deletion; all effects are unmounted. So we also don't have to set HookHasEffect during a deletion, either. This allows us to remove the last remaining passive effect logic from the synchronous layout phase.
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit fd7e0e0:
|
Details of bundled changes.Comparing: 22d16cc...fd7e0e0 react-dom
ReactDOM: size: 0.0%, gzip: -0.0% Size changes (experimental) |
Details of bundled changes.Comparing: 22d16cc...fd7e0e0 react-dom
ReactDOM: size: 0.0%, gzip: -0.0% Size changes (stable) |
Collaborator
Author
|
It's really only the third commit that's interesting. The first two are minor factoring changes that I noticed and didn't feel like opening a separate PR for. |
lunaruan
approved these changes
Jul 31, 2020
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
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.
tl;dr
Some minor refactoring so that I can delete
effect.tag |= HookHasEffectfrom the synchronous deletion path.We don't need to check HookHasEffect during a deletion; all effects are unmounted.
So we also don't have to set HookHasEffect during a deletion, either.
This allows us to remove the last remaining passive effect logic from the synchronous layout phase. (For deletions; there's still some passive logic in the layout phase for mounts/updates that we've yet to remove.)