@@ -3142,4 +3142,85 @@ describe('Store', () => {
31423142 await actAsync ( ( ) => render ( null ) ) ;
31433143 expect ( store ) . toMatchInlineSnapshot ( `` ) ;
31443144 } ) ;
3145+
3146+ // @reactVersion >= 19
3147+ it ( 'should keep suspended boundaries in the Suspense tree but not hidden Activity' , async ( ) => {
3148+ const Activity = React . Activity || React . unstable_Activity ;
3149+
3150+ const never = new Promise ( ( ) => { } ) ;
3151+ function Component ( { children} ) {
3152+ return < div > { children } </ div > ;
3153+ }
3154+
3155+ function App ( { hidden} ) {
3156+ return (
3157+ < >
3158+ < Activity mode = { hidden ? 'hidden' : 'visiible' } >
3159+ < React . Suspense name = "inside-activity" >
3160+ < Component key = "inside-activity" > inside Activity</ Component >
3161+ </ React . Suspense >
3162+ </ Activity >
3163+ < React . Suspense name = "outer-suspense" >
3164+ { hidden ? never : null }
3165+ < React . Suspense name = "inner-suspense" >
3166+ < Component key = "inside-suspense" > inside Suspense</ Component >
3167+ </ React . Suspense >
3168+ </ React . Suspense >
3169+ </ >
3170+ ) ;
3171+ }
3172+
3173+ await actAsync ( ( ) => {
3174+ render ( < App hidden = { false } /> ) ;
3175+ } ) ;
3176+
3177+ expect ( store ) . toMatchInlineSnapshot ( `
3178+ [root]
3179+ ▾ <App>
3180+ ▾ <Activity>
3181+ ▾ <Suspense name="inside-activity">
3182+ <Component key="inside-activity">
3183+ ▾ <Suspense name="outer-suspense">
3184+ ▾ <Suspense name="inner-suspense">
3185+ <Component key="inside-suspense">
3186+ [suspense-root] rects={[{x:1,y:2,width:15,height:1}, {x:1,y:2,width:15,height:1}]}
3187+ <Suspense name="inside-activity" rects={[{x:1,y:2,width:15,height:1}]}>
3188+ <Suspense name="outer-suspense" rects={[{x:1,y:2,width:15,height:1}]}>
3189+ <Suspense name="inner-suspense" rects={[{x:1,y:2,width:15,height:1}]}>
3190+ ` ) ;
3191+
3192+ await actAsync ( ( ) => {
3193+ render ( < App hidden = { true } /> ) ;
3194+ } ) ;
3195+
3196+ expect ( store ) . toMatchInlineSnapshot ( `
3197+ [root]
3198+ ▾ <App>
3199+ <Activity>
3200+ <Suspense name="outer-suspense">
3201+ [suspense-root] rects={[{x:1,y:2,width:15,height:1}, {x:1,y:2,width:15,height:1}]}
3202+ <Suspense name="inside-activity" rects={[{x:1,y:2,width:15,height:1}]}>
3203+ <Suspense name="outer-suspense" rects={[{x:1,y:2,width:15,height:1}]}>
3204+ <Suspense name="inner-suspense" rects={[{x:1,y:2,width:15,height:1}]}>
3205+ ` ) ;
3206+
3207+ await actAsync ( ( ) => {
3208+ render ( < App hidden = { false } /> ) ;
3209+ } ) ;
3210+
3211+ expect ( store ) . toMatchInlineSnapshot ( `
3212+ [root]
3213+ ▾ <App>
3214+ ▾ <Activity>
3215+ ▾ <Suspense name="inside-activity">
3216+ <Component key="inside-activity">
3217+ ▾ <Suspense name="outer-suspense">
3218+ ▾ <Suspense name="inner-suspense">
3219+ <Component key="inside-suspense">
3220+ [suspense-root] rects={[{x:1,y:2,width:15,height:1}, {x:1,y:2,width:15,height:1}]}
3221+ <Suspense name="inside-activity" rects={[{x:1,y:2,width:15,height:1}]}>
3222+ <Suspense name="outer-suspense" rects={[{x:1,y:2,width:15,height:1}]}>
3223+ <Suspense name="inner-suspense" rects={[{x:1,y:2,width:15,height:1}]}>
3224+ ` ) ;
3225+ } ) ;
31453226} ) ;
0 commit comments