-
Notifications
You must be signed in to change notification settings - Fork 49.8k
[Fiber] Child Reconciliation, Refs and Life-Cycles #7707
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
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
d9393ee
Add Fragment fiber type
sebmarkbage e8c1cb4
Add Text node types
sebmarkbage d7322d8
Silence Fiber warning when the feature flag is on
sebmarkbage e05ab67
Fix MultiChild tests so they work with Fiber
sebmarkbage 8c7409b
Add comment about bug in yields
sebmarkbage 4ed67f1
Enable text updates in ReactNoop
sebmarkbage dff0faf
Fiber child reconciliation
sebmarkbage 51f2bf9
Add index field to each fiber
sebmarkbage bcbceae
Don't track side-effects unless needed
sebmarkbage c49a91c
Fast path for create child
sebmarkbage be0acf8
Deletion tracking
sebmarkbage 76725fe
Tag the fiber with the kind of side-effect that was applied to it
sebmarkbage 86e854e
Append deletions to the effect list
sebmarkbage eabed69
Move child updates to use the reconciled effects
sebmarkbage 31ca1e7
Remove beginWork shortcut
sebmarkbage 0262e70
Reset effect list when we recompute children
sebmarkbage f3d7116
Always override priority level when visiting children
sebmarkbage 40989f8
Call componentWillUnmount during deletion phase
sebmarkbage 8360088
Fire componentDidMount/componentDidUpdate life-cycles
sebmarkbage 48cf81c
Resolve ref callbacks
sebmarkbage 8721ec1
Invoke all null ref calls before any new ref calls
sebmarkbage d9efde7
Fix resuming bug
sebmarkbage 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
Add Text node types
These nodes rendering into Text nodes in the DOM. There is a special case when a string is a direct child of a host node. In that case, we won't reconcile it as a child fiber. In terms of fibers, it is terminal. However, the host config special cases it. It is kind of unfortunate that we have to special case this kind of child in the HostConfig. It would be nice to unify this with other types of child instances. Text nodes have some weird special cases, but those special cases tend to *vary* by environment. They're not the same special cases so not sure how valuable it is to have a special protocol and special types for it.
- Loading branch information
commit e8c1cb4b693f58fbc0320e92c2baeab9ffe35f12
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
An alternative approach would overload the existing
createInstanceandcommitUpdateto accept astringand return aTextnode. This might seem like it causes unnecessary branching trouble there, but if you think about it, all other instances tend to be more specific types than "View" or "Element". They're all subclasses so you need to branch on them sooner or later anyway.There isn't necessarily any need to special case Text components here.
It is needed in the internals for reconciliation purposes since string children are special. However, they're not needed here.
You could argue that since they're already special cased by having their own fiber, it allows early branching instead of branching in the switch statement and then branching again inside the host environment adapter.