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:
Sebastian Markbage 2016-09-20 18:12:20 -07:00 committed by Sebastian Markbåge
parent cccc4ae2c6
commit 3979bb9e24
1 changed files with 49 additions and 51 deletions

View File

@ -56,6 +56,11 @@ 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(
returnFiber : Fiber,
@ -106,13 +111,6 @@ function mapAndDeleteRemainingChildren(
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
// to forget to do before returning it. E.g. for the single child case.