@@ -905,6 +905,10 @@ describe('FragmentRefs', () => {
905905      expect ( fragmentRef . current . getRootNode ( ) ) . toBe ( document ) ; 
906906    } ) ; 
907907
908+     // The desired behavior here is to return the topmost disconnected element when 
909+     // fragment + parent are unmounted. Currently we have a pass during unmount that 
910+     // recursively cleans up return pointers of the whole tree. We can change this 
911+     // with a future refactor. See: https://github.com/facebook/react/pull/32682#discussion_r2008313082 
908912    // @gate  enableFragmentRefs 
909913    it ( 'returns the topmost disconnected element if the fragment and parent are unmounted' ,  async  ( )  =>  { 
910914      const  containerRef  =  React . createRef ( ) ; 
@@ -928,11 +932,13 @@ describe('FragmentRefs', () => {
928932
929933      await  act ( ( )  =>  root . render ( < Test  mounted = { true }  /> ) ) ; 
930934      expect ( fragmentRef . current . getRootNode ( ) ) . toBe ( document ) ; 
931-       // const fragmentHandle = fragmentRef.current; 
932-       // const parentRefHandle = parentRef.current; 
935+       const  fragmentHandle  =  fragmentRef . current ; 
933936      await  act ( ( )  =>  root . render ( < Test  mounted = { false }  /> ) ) ; 
934-       // TODO: Should this pass? fragmentHandle._fragmentFiber.return is null 
937+       // TODO: The commented out assertion is the desired behavior. For now, we return 
938+       // the fragment instance itself. This is currently the same behavior if you unmount 
939+       // the fragment but not the parent. See context above. 
935940      // expect(fragmentHandle.getRootNode().id).toBe(parentRefHandle.id); 
941+       expect ( fragmentHandle . getRootNode ( ) ) . toBe ( fragmentHandle ) ; 
936942    } ) ; 
937943
938944    // @gate  enableFragmentRefs 
0 commit comments