@@ -1078,7 +1078,7 @@ function getTaskName(type: mixed): string {
10781078function  initializeElement ( 
10791079  response : Response , 
10801080  element : any , 
1081-   lazyType : null  |  LazyComponent < 
1081+   lazyNode : null  |  LazyComponent < 
10821082    React$Element < any > ,
10831083    SomeChunk< React$Element < any > > , 
10841084  > , 
@@ -1150,25 +1150,15 @@ function initializeElement(
11501150    initializeFakeStack ( response ,  owner ) ; 
11511151  } 
11521152
1153-   if  ( lazyType  !==  null )  { 
1154-     // In case the JSX runtime has validated the lazy type as a static child, we 
1155-     // need to transfer this information to the element. 
1156-     if  ( 
1157-       lazyType . _store  && 
1158-       lazyType . _store . validated  && 
1159-       ! element . _store . validated 
1160-     )  { 
1161-       element . _store . validated  =  lazyType . _store . validated ; 
1162-     } 
1163- 
1164-     // If the lazy type has debug info, and the element doesn't have any, 
1165-     // we should forward it. 
1166-     if  ( lazyType . _debugInfo  !==  null  &&  element . _debugInfo  ===  null )  { 
1167-       element . _debugInfo  =  lazyType . _debugInfo ; 
1168-       // We need to clean it from the lazy type now, so the element won't show 
1169-       // up twice in the component tree. 
1170-       lazyType . _debugInfo  =  null ; 
1171-     } 
1153+   // In case the JSX runtime has validated the lazy type as a static child, we 
1154+   // need to transfer this information to the element. 
1155+   if  ( 
1156+     lazyNode  && 
1157+     lazyNode . _store  && 
1158+     lazyNode . _store . validated  && 
1159+     ! element . _store . validated 
1160+   )  { 
1161+     element . _store . validated  =  lazyNode . _store . validated ; 
11721162  } 
11731163
11741164  // TODO: We should be freezing the element but currently, we might write into 
@@ -1178,6 +1168,7 @@ function initializeElement(
11781168
11791169function  createElement ( 
11801170  response : Response , 
1171+   isRoot : boolean , 
11811172  type : mixed , 
11821173  key : mixed , 
11831174  props : mixed , 
@@ -1286,15 +1277,24 @@ function createElement(
12861277      // a Lazy node referencing this Element to let everything around it proceed. 
12871278      const  blockedChunk : BlockedChunk < React$Element < any >>  = 
12881279        createBlockedChunk ( response ) ; 
1280+       if  ( __DEV__ )  { 
1281+         // If this is the root element, forward the live debug info of the 
1282+         // initializing chunk to the blocked chunk. 
1283+         if  ( isRoot  &&  initializingChunk  !==  null )  { 
1284+           blockedChunk . _debugInfo  =  initializingChunk . _debugInfo ; 
1285+         } 
1286+       } 
12891287      handler . value  =  element ; 
12901288      handler . chunk  =  blockedChunk ; 
1291-       const  lazyType  =  createLazyChunkWrapper ( blockedChunk ,  validated ) ; 
1289+       const  lazyNode  =  createLazyChunkWrapper ( blockedChunk ,  validated ) ; 
12921290      if  ( __DEV__ )  { 
1291+         // Forward the live debug info of the lazy node to the element. 
1292+         element. _debugInfo  =  lazyNode . _debugInfo ; 
12931293        // After we have initialized any blocked references, initialize stack etc. 
1294-         const init  =  initializeElement . bind ( null ,  response ,  element ,  lazyType ) ; 
1294+         const  init  =  initializeElement . bind ( null ,  response ,  element ,  lazyNode ) ; 
12951295        blockedChunk . then ( init ,  init ) ; 
12961296      } 
1297-       return  lazyType ; 
1297+       return lazyNode ;
12981298    } 
12991299  } 
13001300  if  ( __DEV__ )  { 
@@ -1799,8 +1799,7 @@ function transferReferencedDebugInfo(
17991799      referencedValue  !==  null  && 
18001800      ( isArray ( referencedValue )  || 
18011801        typeof  referencedValue [ ASYNC_ITERATOR ]  ===  'function'  || 
1802-         referencedValue . $$typeof  ===  REACT_ELEMENT_TYPE  || 
1803-         referencedValue . $$typeof  ===  REACT_LAZY_TYPE ) 
1802+         referencedValue . $$typeof  ===  REACT_ELEMENT_TYPE ) 
18041803    )   { 
18051804      // We should maybe use a unique symbol for arrays but this is a React owned array. 
18061805      // $FlowFixMe[prop-missing]: This should be added to elements. 
@@ -1823,14 +1822,16 @@ function transferReferencedDebugInfo(
18231822    // is extracted, or if the root is rendered as is. 
18241823    if  ( parentChunk  !==  null )  { 
18251824      const  parentDebugInfo  =  parentChunk . _debugInfo ; 
1826-       for  ( let  i  =  0 ;  i  <  referencedDebugInfo . length ;  ++ i )  { 
1827-         const  debugInfoEntry =  referencedDebugInfo [ i ] ; 
1828-         if  ( debugInfoEntry . name  !=  null )  { 
1829-           ( debugInfoEntry : ReactComponentInfo ) ; 
1830-           // We're not transferring Component info since we use Component info 
1831-           // in Debug info to fill in gaps between Fibers for the parent stack. 
1832-         }  else  { 
1833-           parentDebugInfo. push ( debugInfoEntry ) ; 
1825+       if  ( parentDebugInfo  !==  referencedDebugInfo )  { 
1826+         for  ( let  i  =  0 ;  i  <  referencedDebugInfo . length ;  ++ i )  { 
1827+           const  debugInfoEntry  =  referencedDebugInfo [ i ] ; 
1828+           if  ( debugInfoEntry . name  !=  null )  { 
1829+             ( debugInfoEntry : ReactComponentInfo ) ; 
1830+             // We're not transferring Component info since we use Component info 
1831+             // in Debug info to fill in gaps between Fibers for the parent stack. 
1832+           }  else  { 
1833+             parentDebugInfo . push ( debugInfoEntry ) ; 
1834+           } 
18341835        } 
18351836      } 
18361837    } 
@@ -2400,6 +2401,7 @@ function parseModelString(
24002401function  parseModelTuple ( 
24012402  response : Response , 
24022403  value : { + [ key : string ] : JSONValue }  |  $ReadOnlyArray < JSONValue > , 
2404+   isRoot : boolean , 
24032405) : any  { 
24042406  const  tuple : [ mixed ,  mixed ,  mixed ,  mixed ]  =  ( value : any ) ; 
24052407
@@ -2408,6 +2410,7 @@ function parseModelTuple(
24082410    // Or even change the ReactElement type to be an array. 
24092411    return  createElement ( 
24102412      response , 
2413+       isRoot , 
24112414      tuple [ 1 ] , 
24122415      tuple [ 2 ] , 
24132416      tuple [ 3 ] , 
@@ -4974,7 +4977,8 @@ function createFromJSONCallback(response: Response) {
49744977      return  parseModelString ( response ,  this ,  key ,  value ) ; 
49754978    } 
49764979    if  ( typeof  value  ===  'object'  &&  value  !==  null )  { 
4977-       return  parseModelTuple ( response ,  value ) ; 
4980+       const  isRoot  =  key  ===  '' ; 
4981+       return  parseModelTuple ( response ,  value ,  isRoot ) ; 
49784982    } 
49794983    return  value ; 
49804984  } ; 
0 commit comments