-
Notifications
You must be signed in to change notification settings - Fork 50.2k
[Fiber] Update root children using appendChild/insertBefore/removeChild #8400
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
Changes from all commits
78add2d
fde18a4
024e2a0
ea34204
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -300,7 +300,24 @@ module.exports = function<T, P, I, TI, C>( | |
| } | ||
|
|
||
| function updatePortalComponent(current, workInProgress) { | ||
| reconcileChildren(current, workInProgress, workInProgress.pendingProps); | ||
| const priorityLevel = workInProgress.pendingWorkPriority; | ||
| const nextChildren = workInProgress.pendingProps; | ||
| if (!current) { | ||
| // Portals are special because we don't append the children during mount | ||
| // but at commit. Therefore we need to track insertions which the normal | ||
| // flow doesn't do during mount. This doesn't happen at the root because | ||
| // the root always starts with a "current" with a null child. | ||
| // TODO: Consider unifying this with how the root works. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How could this be unified?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This only happens to work because HostContainer always end up with two Fibers but that seems unnecessary.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if we fix that, then this same logic will need to be applied for HostContainer too |
||
| workInProgress.child = reconcileChildFibersInPlace( | ||
| workInProgress, | ||
| workInProgress.child, | ||
| nextChildren, | ||
| priorityLevel | ||
| ); | ||
| markChildAsProgressed(current, workInProgress, priorityLevel); | ||
| } else { | ||
| reconcileChildren(current, workInProgress, nextChildren); | ||
| } | ||
| } | ||
|
|
||
| /* | ||
|
|
||
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.
will this only be called on the initial mount? or also when new children get's appended on a already mounted node?
will appendChild or appendInitialChild handle:
["Foo"]->["Foo", "Bar"]?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.
This would be handled by
appendChildif the parent is already in the DOM.