Skip to content

Commit 5926765

Browse files
authored
Revert "Clear memoizedState on unmount of fiber to avoid memory leak (#14218)" (#14275)
This reverts commit 9b2fb24.
1 parent 9b2fb24 commit 5926765

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

packages/react-reconciler/src/ReactFiberCommitWork.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -726,20 +726,11 @@ function detachFiber(current: Fiber) {
726726
// get GC:ed but we don't know which for sure which parent is the current
727727
// one so we'll settle for GC:ing the subtree of this child. This child
728728
// 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.
730729
current.return = null;
731730
current.child = null;
732-
current.memoizedState = null;
733-
current.updateQueue = null;
734-
current.firstEffect = null;
735-
current.lastEffect = null;
736731
if (current.alternate) {
737-
current.alternate.return = null;
738732
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;
743734
}
744735
}
745736

0 commit comments

Comments
 (0)