Skip to content

Commit ce7c014

Browse files
authored
Don't increase priority when cloning current children (#10123)
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.
1 parent 8f4d307 commit ce7c014

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/renderers/shared/fiber/ReactChildFiber.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,6 @@ exports.mountChildFibersInPlace = ChildReconciler(false, false);
14491449
exports.cloneChildFibers = function(
14501450
current: Fiber | null,
14511451
workInProgress: Fiber,
1452-
renderPriority: PriorityLevel,
14531452
): void {
14541453
invariant(
14551454
current === null || workInProgress.child === current.child,
@@ -1461,7 +1460,10 @@ exports.cloneChildFibers = function(
14611460
}
14621461

14631462
let currentChild = workInProgress.child;
1464-
let newChild = createWorkInProgress(currentChild, renderPriority);
1463+
let newChild = createWorkInProgress(
1464+
currentChild,
1465+
currentChild.pendingWorkPriority,
1466+
);
14651467
// TODO: Pass this as an argument, since it's easy to forget.
14661468
newChild.pendingProps = currentChild.pendingProps;
14671469
workInProgress.child = newChild;
@@ -1471,7 +1473,7 @@ exports.cloneChildFibers = function(
14711473
currentChild = currentChild.sibling;
14721474
newChild = newChild.sibling = createWorkInProgress(
14731475
currentChild,
1474-
renderPriority,
1476+
currentChild.pendingWorkPriority,
14751477
);
14761478
newChild.pendingProps = currentChild.pendingProps;
14771479
newChild.return = workInProgress;

src/renderers/shared/fiber/ReactFiberBeginWork.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,9 +674,7 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
674674
// return null;
675675
// }
676676

677-
// TODO: Pass the priority as an argument
678-
const renderPriority = workInProgress.pendingWorkPriority;
679-
cloneChildFibers(current, workInProgress, renderPriority);
677+
cloneChildFibers(current, workInProgress);
680678
return workInProgress.child;
681679
}
682680

src/renderers/shared/fiber/__tests__/__snapshots__/ReactIncrementalPerf-test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ exports[`ReactDebugFiberPerf deduplicates lifecycle names during commit to reduc
6161
⚛ B.componentDidUpdate
6262
⚛ B [update]
6363
⛔ (Committing Changes) Warning: Caused by a cascading update in earlier commit
64-
⚛ (Committing Host Effects: 6 Total)
65-
⚛ (Calling Lifecycle Methods: 6 Total)
64+
⚛ (Committing Host Effects: 3 Total)
65+
⚛ (Calling Lifecycle Methods: 3 Total)
6666
⚛ B.componentDidUpdate
6767
"
6868
`;

0 commit comments

Comments
 (0)