From 30fa2f5ea3313b4b7932783d8ac71b5d59b8a8c7 Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Tue, 17 Sep 2019 17:30:22 +0200 Subject: [PATCH] [react-core] Clear more properties in detachFiber (#16807) --- .../react-reconciler/src/ReactFiberCommitWork.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.js b/packages/react-reconciler/src/ReactFiberCommitWork.js index e75ed5488e33..6a80ba362cfc 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.js @@ -858,6 +858,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 @@ -868,13 +869,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); } }