Skip to content

Commit 5daa2cf

Browse files
committed
Reset subtreeFlags in resetWorkInProgress
Alternate fix to #20942 There was already a TODO to make this change, but at the time I left it, I couldn't think of a way that it would actually cause a bug, and I was hesistant to change something without fully understanding the ramifications. This was during a time when we were hunting down a different bug, so we were especially risk averse. What I should have done in retrospect is put the change behind a flag and tried rolling it out once the other bug had been flushed out. OTOH, now we have a regression test, which wouldn't have otherwise, and the bug it caused rarely fired in production.
1 parent 80076d7 commit 5daa2cf

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

packages/react-reconciler/src/ReactFiber.new.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,7 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) {
388388
workInProgress.lanes = current.lanes;
389389

390390
workInProgress.child = current.child;
391-
// TODO: `subtreeFlags` should be reset to NoFlags, like we do in
392-
// `createWorkInProgress`. Nothing reads this until the complete phase,
393-
// currently, but it might in the future, and we should be consistent.
394-
workInProgress.subtreeFlags = current.subtreeFlags;
391+
workInProgress.subtreeFlags = NoFlags;
395392
workInProgress.deletions = null;
396393
workInProgress.memoizedProps = current.memoizedProps;
397394
workInProgress.memoizedState = current.memoizedState;

packages/react-reconciler/src/ReactFiber.old.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,7 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) {
388388
workInProgress.lanes = current.lanes;
389389

390390
workInProgress.child = current.child;
391-
// TODO: `subtreeFlags` should be reset to NoFlags, like we do in
392-
// `createWorkInProgress`. Nothing reads this until the complete phase,
393-
// currently, but it might in the future, and we should be consistent.
394-
workInProgress.subtreeFlags = current.subtreeFlags;
391+
workInProgress.subtreeFlags = NoFlags;
395392
workInProgress.deletions = null;
396393
workInProgress.memoizedProps = current.memoizedProps;
397394
workInProgress.memoizedState = current.memoizedState;

0 commit comments

Comments
 (0)