From 5e5bae73edcdf02ccef62c9cfb5a18991e61878c Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Fri, 7 Jul 2017 14:34:06 -0700 Subject: [PATCH] Don't increase priority when cloning current children This fixes a snapshot test regression introduced by #10008. I had noticed this change and believe the new behavior was correct, but upon further investigation I was wrong. This reverts the snapshot test and fixes it accordingly. --- src/renderers/shared/fiber/ReactChildFiber.js | 8 +++++--- src/renderers/shared/fiber/ReactFiberBeginWork.js | 4 +--- .../__snapshots__/ReactIncrementalPerf-test.js.snap | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/renderers/shared/fiber/ReactChildFiber.js b/src/renderers/shared/fiber/ReactChildFiber.js index 41bd8f3983e..d918261264c 100644 --- a/src/renderers/shared/fiber/ReactChildFiber.js +++ b/src/renderers/shared/fiber/ReactChildFiber.js @@ -1449,7 +1449,6 @@ exports.mountChildFibersInPlace = ChildReconciler(false, false); exports.cloneChildFibers = function( current: Fiber | null, workInProgress: Fiber, - renderPriority: PriorityLevel, ): void { invariant( current === null || workInProgress.child === current.child, @@ -1461,7 +1460,10 @@ exports.cloneChildFibers = function( } let currentChild = workInProgress.child; - let newChild = createWorkInProgress(currentChild, renderPriority); + let newChild = createWorkInProgress( + currentChild, + currentChild.pendingWorkPriority, + ); // TODO: Pass this as an argument, since it's easy to forget. newChild.pendingProps = currentChild.pendingProps; workInProgress.child = newChild; @@ -1471,7 +1473,7 @@ exports.cloneChildFibers = function( currentChild = currentChild.sibling; newChild = newChild.sibling = createWorkInProgress( currentChild, - renderPriority, + currentChild.pendingWorkPriority, ); newChild.pendingProps = currentChild.pendingProps; newChild.return = workInProgress; diff --git a/src/renderers/shared/fiber/ReactFiberBeginWork.js b/src/renderers/shared/fiber/ReactFiberBeginWork.js index da6240b91d3..32f91e7d178 100644 --- a/src/renderers/shared/fiber/ReactFiberBeginWork.js +++ b/src/renderers/shared/fiber/ReactFiberBeginWork.js @@ -674,9 +674,7 @@ module.exports = function( // return null; // } - // TODO: Pass the priority as an argument - const renderPriority = workInProgress.pendingWorkPriority; - cloneChildFibers(current, workInProgress, renderPriority); + cloneChildFibers(current, workInProgress); return workInProgress.child; } diff --git a/src/renderers/shared/fiber/__tests__/__snapshots__/ReactIncrementalPerf-test.js.snap b/src/renderers/shared/fiber/__tests__/__snapshots__/ReactIncrementalPerf-test.js.snap index 25419844f1c..a816615ba46 100644 --- a/src/renderers/shared/fiber/__tests__/__snapshots__/ReactIncrementalPerf-test.js.snap +++ b/src/renderers/shared/fiber/__tests__/__snapshots__/ReactIncrementalPerf-test.js.snap @@ -61,8 +61,8 @@ exports[`ReactDebugFiberPerf deduplicates lifecycle names during commit to reduc ⚛ B.componentDidUpdate ⚛ B [update] ⛔ (Committing Changes) Warning: Caused by a cascading update in earlier commit - ⚛ (Committing Host Effects: 6 Total) - ⚛ (Calling Lifecycle Methods: 6 Total) + ⚛ (Committing Host Effects: 3 Total) + ⚛ (Calling Lifecycle Methods: 3 Total) ⚛ B.componentDidUpdate " `;