@@ -5292,6 +5292,54 @@ describe('ReactDOMFizzServer', () => {
52925292      expect ( getVisibleChildren ( container ) ) . toEqual ( 'ABC' ) ; 
52935293    } ) ; 
52945294
5295+     // @gate  enableUseHook 
5296+     it ( 'basic use(context)' ,  async  ( )  =>  { 
5297+       const  ContextA  =  React . createContext ( 'default' ) ; 
5298+       const  ContextB  =  React . createContext ( 'B' ) ; 
5299+       const  ServerContext  =  React . createServerContext ( 
5300+         'ServerContext' , 
5301+         'default' , 
5302+       ) ; 
5303+       function  Client ( )  { 
5304+         return  use ( ContextA )  +  use ( ContextB ) ; 
5305+       } 
5306+       function  ServerComponent ( )  { 
5307+         return  use ( ServerContext ) ; 
5308+       } 
5309+       function  Server ( )  { 
5310+         return  ( 
5311+           < ServerContext . Provider  value = "C" > 
5312+             < ServerComponent  /> 
5313+           </ ServerContext . Provider > 
5314+         ) ; 
5315+       } 
5316+       function  App ( )  { 
5317+         return  ( 
5318+           < > 
5319+             < ContextA . Provider  value = "A" > 
5320+               < Client  /> 
5321+             </ ContextA . Provider > 
5322+             < Server  /> 
5323+           </ > 
5324+         ) ; 
5325+       } 
5326+ 
5327+       await  act ( async  ( )  =>  { 
5328+         const  { pipe}  =  ReactDOMFizzServer . renderToPipeableStream ( < App  /> ) ; 
5329+         pipe ( writable ) ; 
5330+       } ) ; 
5331+       expect ( getVisibleChildren ( container ) ) . toEqual ( [ 'AB' ,  'C' ] ) ; 
5332+ 
5333+       // Hydration uses a different renderer runtime (Fiber instead of Fizz). 
5334+       // We reset _currentRenderer here to not trigger a warning about multiple 
5335+       // renderers concurrently using these contexts 
5336+       ContextA . _currentRenderer  =  null ; 
5337+       ServerContext . _currentRenderer  =  null ; 
5338+       ReactDOMClient . hydrateRoot ( container ,  < App  /> ) ; 
5339+       expect ( Scheduler ) . toFlushAndYield ( [ ] ) ; 
5340+       expect ( getVisibleChildren ( container ) ) . toEqual ( [ 'AB' ,  'C' ] ) ; 
5341+     } ) ; 
5342+ 
52955343    // @gate  enableUseHook 
52965344    it ( 'use(promise) in multiple components' ,  async  ( )  =>  { 
52975345      const  promiseA  =  Promise . resolve ( 'A' ) ; 
0 commit comments