@@ -893,6 +893,7 @@ function commitNestedUnmounts(
893893}
894894
895895function detachFiber ( current : Fiber ) {
896+ const alternate = current . alternate ;
896897 // Cut off the return pointers to disconnect it from the tree. Ideally, we
897898 // should clear the child pointer of the parent alternate to let this
898899 // get GC:ed but we don't know which for sure which parent is the current
@@ -903,13 +904,14 @@ function detachFiber(current: Fiber) {
903904 current . memoizedState = null ;
904905 current . updateQueue = null ;
905906 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 ;
907913 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 ) ;
913915 }
914916}
915917
0 commit comments