File tree Expand file tree Collapse file tree 2 files changed +24
-14
lines changed
packages/react-reconciler/src Expand file tree Collapse file tree 2 files changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -2915,13 +2915,18 @@ function commitPassiveUnmountInsideDeletedTreeOnFiber(
29152915 case LegacyHiddenComponent :
29162916 case OffscreenComponent : {
29172917 if ( enableCache ) {
2918- const cache : Cache = current . memoizedState ?. cachePool ?. pool ;
2919- // Retain/release the cache used for pending (suspended) nodes.
2920- // Note that this is only reached in the non-suspended/visible case:
2921- // when the content is suspended/hidden, the retain/release occurs
2922- // via the parent Suspense component (see case above).
2923- if ( cache != null ) {
2924- retainCache ( cache ) ;
2918+ if (
2919+ current . memoizedState !== null &&
2920+ current . memoizedState . cachePool !== null
2921+ ) {
2922+ const cache : Cache = current . memoizedState . cachePool . pool ;
2923+ // Retain/release the cache used for pending (suspended) nodes.
2924+ // Note that this is only reached in the non-suspended/visible case:
2925+ // when the content is suspended/hidden, the retain/release occurs
2926+ // via the parent Suspense component (see case above).
2927+ if ( cache != null ) {
2928+ retainCache ( cache ) ;
2929+ }
29252930 }
29262931 }
29272932 break ;
Original file line number Diff line number Diff line change @@ -2915,13 +2915,18 @@ function commitPassiveUnmountInsideDeletedTreeOnFiber(
29152915 case LegacyHiddenComponent :
29162916 case OffscreenComponent : {
29172917 if ( enableCache ) {
2918- const cache : Cache = current . memoizedState ?. cachePool ?. pool ;
2919- // Retain/release the cache used for pending (suspended) nodes.
2920- // Note that this is only reached in the non-suspended/visible case:
2921- // when the content is suspended/hidden, the retain/release occurs
2922- // via the parent Suspense component (see case above).
2923- if ( cache != null ) {
2924- retainCache ( cache ) ;
2918+ if (
2919+ current . memoizedState !== null &&
2920+ current . memoizedState . cachePool !== null
2921+ ) {
2922+ const cache : Cache = current . memoizedState . cachePool . pool ;
2923+ // Retain/release the cache used for pending (suspended) nodes.
2924+ // Note that this is only reached in the non-suspended/visible case:
2925+ // when the content is suspended/hidden, the retain/release occurs
2926+ // via the parent Suspense component (see case above).
2927+ if ( cache != null ) {
2928+ retainCache ( cache ) ;
2929+ }
29252930 }
29262931 }
29272932 break ;
You can’t perform that action at this time.
0 commit comments