Skip to content

Commit e83199c

Browse files
committed
Set return pointer when reusing current tree
We always set the return pointer on freshly cloned, work-in-progress fibers. However, we were neglecting to set them on trees that are reused from current. Update the return pointer so the tree is consistent. This is a code smell because it assumes the commit phase is never concurrent with the render phase. Our eventual goal is to make fibers a lock free data structure. Will address further during refactor to alternate model.
1 parent 45c295e commit e83199c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,11 @@ function bubbleProperties(completedWork: Fiber) {
738738
subtreeFlags |= child.subtreeFlags;
739739
subtreeFlags |= child.flags;
740740

741+
// Update the return pointer so the tree is consistent. This is a code
742+
// smell because it assumes the commit phase is never concurrent with
743+
// the render phase. Will address during refactor to alternate model.
744+
child.return = completedWork;
745+
741746
child = child.sibling;
742747
}
743748
}
@@ -784,6 +789,11 @@ function bubbleProperties(completedWork: Fiber) {
784789
subtreeFlags |= child.subtreeFlags & StaticMask;
785790
subtreeFlags |= child.flags & StaticMask;
786791

792+
// Update the return pointer so the tree is consistent. This is a code
793+
// smell because it assumes the commit phase is never concurrent with
794+
// the render phase. Will address during refactor to alternate model.
795+
child.return = completedWork;
796+
787797
child = child.sibling;
788798
}
789799
}

0 commit comments

Comments
 (0)