Don't track side-effects unless needed
We don't need to track side-effects for a parent that has never been mounted before. It will simply inject all its children when it completes.
This commit is contained in:
parent
cccc4ae2c6
commit
3979bb9e24
|
@ -56,35 +56,40 @@ const {
|
|||
NoWork,
|
||||
} = ReactPriorityLevel;
|
||||
|
||||
// This wrapper function exists because I expect to clone the code in each path
|
||||
// to be able to optimize each path individually by branching early. This needs
|
||||
// a compiler or we can do it manually. Helpers that don't need this branching
|
||||
// live outside of this function.
|
||||
function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
|
||||
function deleteChild(
|
||||
function deleteChild(
|
||||
returnFiber : Fiber,
|
||||
childToDelete : Fiber
|
||||
) {
|
||||
) {
|
||||
if (!shouldTrackSideEffects) {
|
||||
// Noop.
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Add this child to the side-effect queue for deletion.
|
||||
}
|
||||
}
|
||||
|
||||
function deleteRemainingChildren(
|
||||
function deleteRemainingChildren(
|
||||
returnFiber : Fiber,
|
||||
currentFirstChild : ?Fiber
|
||||
) {
|
||||
) {
|
||||
if (!shouldTrackSideEffects) {
|
||||
// Noop.
|
||||
return null;
|
||||
}
|
||||
// TODO: Add these children to the side-effect queue for deletion.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function mapAndDeleteRemainingChildren(
|
||||
function mapAndDeleteRemainingChildren(
|
||||
returnFiber : Fiber,
|
||||
currentFirstChild : ?Fiber
|
||||
) : Map<string, Fiber> {
|
||||
) : Map<string, Fiber> {
|
||||
// Add the remaining children to a temporary map so that we can find them by
|
||||
// keys quickly. At the same time, we'll flag them all for deletion. However,
|
||||
// we will then undo the deletion as we restore children. Implicit (null) keys
|
||||
|
@ -104,14 +109,7 @@ function mapAndDeleteRemainingChildren(
|
|||
existingChild = existingChild.sibling;
|
||||
}
|
||||
return existingChildren;
|
||||
}
|
||||
|
||||
|
||||
// This wrapper function exists because I expect to clone the code in each path
|
||||
// to be able to optimize each path individually by branching early. This needs
|
||||
// a compiler or we can do it manually. Helpers that don't need this branching
|
||||
// live outside of this function.
|
||||
function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
}
|
||||
|
||||
function useFiber(fiber : Fiber, priority : PriorityLevel) {
|
||||
// We currently set sibling to null and index to 0 here because it is easy
|
||||
|
|
Loading…
Reference in New Issue