Revert "Clear memoizedState on unmount of fiber to avoid memory leak (#14218)" (#14275)
This reverts commit 9b2fb24f99ebed9af2c092de7a5f31c38f8af97a.
Dominic Gannaway committed
Nov 19, 2018 at 15:24 UTC
592676503c3a33596b295b70635d8317c05f81ad
1 file changed
+1
-10
packages/react-reconciler/src/ReactFiberCommitWork.js
+1
-10
@@ -726,20 +726,11 @@ function detachFiber(current: Fiber) {
726
// get GC:ed but we don't know which for sure which parent is the current
727
// one so we'll settle for GC:ing the subtree of this child. This child
728
// itself will be GC:ed when the parent updates the next time.
729
- // We do not null out the 'nextEffect' field as it causes tests to fail.
729
current.return = null;
730
current.child = null;
732
- current.memoizedState = null;
733
- current.updateQueue = null;
734
- current.firstEffect = null;
735
- current.lastEffect = null;
731
if (current.alternate) {
737
- current.alternate.return = null;
732
current.alternate.child = null;
739
- current.alternate.memoizedState = null;
740
- current.alternate.updateQueue = null;
741
- current.alternate.firstEffect = null;
742
- current.alternate.lastEffect = null;
733
+ current.alternate.return = null;
734
}
735
}
736