Skip to content

Commit

Permalink
[react-core] Clear more properties in detachFiber (#16807)
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm committed Sep 17, 2019
1 parent 8e0c574 commit 2f1e8c5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/react-reconciler/src/ReactFiberCommitWork.js
Expand Up @@ -893,6 +893,7 @@ function commitNestedUnmounts(
}

function detachFiber(current: Fiber) {
const alternate = current.alternate;
// Cut off the return pointers to disconnect it from the tree. Ideally, we
// should clear the child pointer of the parent alternate to let this
// get GC:ed but we don't know which for sure which parent is the current
Expand All @@ -903,13 +904,14 @@ function detachFiber(current: Fiber) {
current.memoizedState = null;
current.updateQueue = null;
current.dependencies = null;
const alternate = current.alternate;
current.sibling = null;
current.alternate = null;
current.firstEffect = null;
current.lastEffect = null;
current.pendingProps = null;
current.memoizedProps = null;
if (alternate !== null) {
alternate.return = null;
alternate.child = null;
alternate.memoizedState = null;
alternate.updateQueue = null;
alternate.dependencies = null;
detachFiber(alternate);
}
}

Expand Down

0 comments on commit 2f1e8c5

Please sign in to comment.