Skip to content

Commit

Permalink
Revert "Clear memoizedState on unmount of fiber to avoid memory leak (f…
Browse files Browse the repository at this point in the history
…acebook#14218)" (facebook#14275)

This reverts commit 9b2fb24.
  • Loading branch information
trueadm authored and n8schloss committed Jan 31, 2019
1 parent 8cae68c commit e73a3f2
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions packages/react-reconciler/src/ReactFiberCommitWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit e73a3f2

Please sign in to comment.