Skip to content

Commit 30fa2f5

Browse files
trueadmgaearon
authored andcommitted
[react-core] Clear more properties in detachFiber (facebook#16807)
1 parent ea374e7 commit 30fa2f5

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/react-reconciler/src/ReactFiberCommitWork.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,7 @@ function commitNestedUnmounts(
858858
}
859859

860860
function detachFiber(current: Fiber) {
861+
const alternate = current.alternate;
861862
// Cut off the return pointers to disconnect it from the tree. Ideally, we
862863
// should clear the child pointer of the parent alternate to let this
863864
// get GC:ed but we don't know which for sure which parent is the current
@@ -868,13 +869,14 @@ function detachFiber(current: Fiber) {
868869
current.memoizedState = null;
869870
current.updateQueue = null;
870871
current.dependencies = null;
871-
const alternate = current.alternate;
872+
current.sibling = null;
873+
current.alternate = null;
874+
current.firstEffect = null;
875+
current.lastEffect = null;
876+
current.pendingProps = null;
877+
current.memoizedProps = null;
872878
if (alternate !== null) {
873-
alternate.return = null;
874-
alternate.child = null;
875-
alternate.memoizedState = null;
876-
alternate.updateQueue = null;
877-
alternate.dependencies = null;
879+
detachFiber(alternate);
878880
}
879881
}
880882

0 commit comments

Comments
 (0)