@@ -98,6 +98,7 @@ import {
9898  enableSchedulingProfiler , 
9999  enablePersistentOffscreenHostContainer , 
100100  enableTransitionTracing , 
101+   enableLegacyHidden , 
101102}  from  'shared/ReactFeatureFlags' ; 
102103import  isArray  from  'shared/isArray' ; 
103104import  shallowEqual  from  'shared/shallowEqual' ; 
@@ -640,7 +641,7 @@ function updateOffscreenComponent(
640641
641642  if  ( 
642643    nextProps . mode  ===  'hidden'  || 
643-     nextProps . mode  ===  'unstable-defer-without-hiding' 
644+     ( enableLegacyHidden   &&   nextProps . mode  ===  'unstable-defer-without-hiding' ) 
644645  )  { 
645646    // Rendering a hidden tree. 
646647    if  ( ( workInProgress . mode  &  ConcurrentMode )  ===  NoMode )  { 
@@ -774,7 +775,7 @@ function updateOffscreenComponent(
774775    // or some other infra that expects a HostComponent. 
775776    const  isHidden  = 
776777      nextProps . mode  ===  'hidden'  && 
777-       workInProgress . tag  !==  LegacyHiddenComponent ; 
778+       ( ! enableLegacyHidden   ||   workInProgress . tag  !==  LegacyHiddenComponent ) ; 
778779    const  offscreenContainer  =  reconcileOffscreenHostContainer ( 
779780      current , 
780781      workInProgress , 
@@ -3948,7 +3949,14 @@ function beginWork(
39483949      return  updateOffscreenComponent ( current ,  workInProgress ,  renderLanes ) ; 
39493950    } 
39503951    case  LegacyHiddenComponent : { 
3951-       return  updateLegacyHiddenComponent ( current ,  workInProgress ,  renderLanes ) ; 
3952+       if  ( enableLegacyHidden )  { 
3953+         return  updateLegacyHiddenComponent ( 
3954+           current , 
3955+           workInProgress , 
3956+           renderLanes , 
3957+         ) ; 
3958+       } 
3959+       break ; 
39523960    } 
39533961    case  CacheComponent : { 
39543962      if  ( enableCache )  { 
0 commit comments