@samitouri / QOS-React-2 / commits / 2f1e8c5f78

[react-core] Clear more properties in detachFiber (#16807)

Dominic Gannaway committed Sep 17, 2019 at 17:30 UTC 2f1e8c5f784e288beef9ac5b9365304f841e611f
1 file changed +8 -6
packages/react-reconciler/src/ReactFiberCommitWork.js
+8 -6
@@ -893,6 +893,7 @@ function commitNestedUnmounts(
893 }
894
895 function detachFiber(current: Fiber) {
896 + const alternate = current.alternate;
897 // Cut off the return pointers to disconnect it from the tree. Ideally, we
898 // should clear the child pointer of the parent alternate to let this
899 // get GC:ed but we don't know which for sure which parent is the current
@@ -903,13 +904,14 @@ function detachFiber(current: Fiber) {
904 current.memoizedState = null;
905 current.updateQueue = null;
906 current.dependencies = null;
906 - const alternate = current.alternate;
907 + current.sibling = null;
908 + current.alternate = null;
909 + current.firstEffect = null;
910 + current.lastEffect = null;
911 + current.pendingProps = null;
912 + current.memoizedProps = null;
913 if (alternate !== null) {
908 - alternate.return = null;
909 - alternate.child = null;
910 - alternate.memoizedState = null;
911 - alternate.updateQueue = null;
912 - alternate.dependencies = null;
914 + detachFiber(alternate);
915 }
916 }
917