From 9a91f12002f2583ccadc83d5889a91d11334d7b4 Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Mon, 19 Nov 2018 15:24:31 +0000 Subject: [PATCH] Revert "Clear memoizedState on unmount of fiber to avoid memory leak (#14218)" This reverts commit 9b2fb24f99ebed9af2c092de7a5f31c38f8af97a. --- packages/react-reconciler/src/ReactFiberCommitWork.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.js b/packages/react-reconciler/src/ReactFiberCommitWork.js index 0dc3d27f1dcfb..55a39ee640db8 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.js @@ -726,20 +726,11 @@ function detachFiber(current: Fiber) { // get GC:ed but we don't know which for sure which parent is the current // one so we'll settle for GC:ing the subtree of this child. This child // itself will be GC:ed when the parent updates the next time. - // We do not null out the 'nextEffect' field as it causes tests to fail. current.return = null; current.child = null; - current.memoizedState = null; - current.updateQueue = null; - current.firstEffect = null; - current.lastEffect = null; if (current.alternate) { - current.alternate.return = null; current.alternate.child = null; - current.alternate.memoizedState = null; - current.alternate.updateQueue = null; - current.alternate.firstEffect = null; - current.alternate.lastEffect = null; + current.alternate.return = null; } }