Clear fields on unmount of fiber to avoid memory leak (#14276)
* Clear fields on unmount of fiber to avoid memory leak
This commit is contained in:
parent
592676503c
commit
0e9cb3f5d0
|
@ -728,9 +728,14 @@ function detachFiber(current: Fiber) {
|
|||
// itself will be GC:ed when the parent updates the next time.
|
||||
current.return = null;
|
||||
current.child = null;
|
||||
if (current.alternate) {
|
||||
current.alternate.child = null;
|
||||
current.alternate.return = null;
|
||||
current.memoizedState = null;
|
||||
current.updateQueue = null;
|
||||
const alternate = current.alternate;
|
||||
if (alternate !== null) {
|
||||
alternate.return = null;
|
||||
alternate.child = null;
|
||||
alternate.memoizedState = null;
|
||||
alternate.updateQueue = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue