Skip to content

Commit 21fa5d2

Browse files
committed
[react-core] Clear more properties in detachFiber
1 parent 3af05de commit 21fa5d2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/react-reconciler/src/ReactFiberCommitWork.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ function commitNestedUnmounts(
893893
}
894894

895895
function detachFiber(current: Fiber) {
896+
const alternate = current.alternate;
896897
// Cut off the return pointers to disconnect it from the tree. Ideally, we
897898
// should clear the child pointer of the parent alternate to let this
898899
// get GC:ed but we don't know which for sure which parent is the current
@@ -903,13 +904,14 @@ function detachFiber(current: Fiber) {
903904
current.memoizedState = null;
904905
current.updateQueue = null;
905906
current.dependencies = null;
906-
const alternate = current.alternate;
907+
current.sibling = null;
908+
current.alternate = null;
909+
current.firstEffect = null;
910+
current.lastEffect = null;
911+
current.pendingProps = null;
912+
current.memoizedProps = null;
907913
if (alternate !== null) {
908-
alternate.return = null;
909-
alternate.child = null;
910-
alternate.memoizedState = null;
911-
alternate.updateQueue = null;
912-
alternate.dependencies = null;
914+
detachFiber(alternate);
913915
}
914916
}
915917

0 commit comments

Comments
 (0)