@@ -1104,7 +1104,8 @@ if (__DEV__) {
1104
1104
bundlerConfig ,
1105
1105
onError ,
1106
1106
identifierPrefix ,
1107
- onPostpone
1107
+ onPostpone ,
1108
+ environmentName
1108
1109
) {
1109
1110
if (
1110
1111
ReactCurrentCache . current !== null &&
@@ -1149,6 +1150,12 @@ if (__DEV__) {
1149
1150
onPostpone :
1150
1151
onPostpone === undefined ? defaultPostponeHandler : onPostpone
1151
1152
} ;
1153
+
1154
+ {
1155
+ request . environmentName =
1156
+ environmentName === undefined ? "server" : environmentName ;
1157
+ }
1158
+
1152
1159
var rootTask = createTask ( request , model , null , false , abortSet ) ;
1153
1160
pingedTasks . push ( rootTask ) ;
1154
1161
return request ;
@@ -1169,6 +1176,15 @@ if (__DEV__) {
1169
1176
request . abortableTasks
1170
1177
) ;
1171
1178
1179
+ {
1180
+ // If this came from Flight, forward any debug info into this new row.
1181
+ var debugInfo = thenable . _debugInfo ;
1182
+
1183
+ if ( debugInfo ) {
1184
+ forwardDebugInfo ( request , newTask . id , debugInfo ) ;
1185
+ }
1186
+ }
1187
+
1172
1188
switch ( thenable . status ) {
1173
1189
case "fulfilled" : {
1174
1190
// We have the resolved value, we can go ahead and schedule it for serialization.
@@ -1308,6 +1324,12 @@ if (__DEV__) {
1308
1324
_payload : thenable ,
1309
1325
_init : readThenable
1310
1326
} ;
1327
+
1328
+ {
1329
+ // If this came from React, transfer the debug info.
1330
+ lazyType . _debugInfo = thenable . _debugInfo || [ ] ;
1331
+ }
1332
+
1311
1333
return lazyType ;
1312
1334
}
1313
1335
@@ -1329,7 +1351,8 @@ if (__DEV__) {
1329
1351
var componentName = Component . displayName || Component . name || "" ;
1330
1352
request . pendingChunks ++ ;
1331
1353
emitDebugChunk ( request , debugID , {
1332
- name : componentName
1354
+ name : componentName ,
1355
+ env : request . environmentName
1333
1356
} ) ;
1334
1357
}
1335
1358
}
@@ -1378,6 +1401,24 @@ if (__DEV__) {
1378
1401
}
1379
1402
1380
1403
function renderFragment ( request , task , children ) {
1404
+ {
1405
+ var debugInfo = children . _debugInfo ;
1406
+
1407
+ if ( debugInfo ) {
1408
+ // If this came from Flight, forward any debug info into this new row.
1409
+ if ( debugID === null ) {
1410
+ // We don't have a chunk to assign debug info. We need to outline this
1411
+ // component to assign it an ID.
1412
+ return outlineTask ( request , task ) ;
1413
+ } else {
1414
+ // Forward any debug info we have the first time we see it.
1415
+ // We do this after init so that we have received all the debug info
1416
+ // from the server by the time we emit it.
1417
+ forwardDebugInfo ( request , debugID , debugInfo ) ;
1418
+ }
1419
+ }
1420
+ }
1421
+
1381
1422
if ( task . keyPath !== null ) {
1382
1423
// We have a Server Component that specifies a key but we're now splitting
1383
1424
// the tree using a fragment.
@@ -1969,7 +2010,23 @@ if (__DEV__) {
1969
2010
_writtenObjects . set ( value , - 1 ) ;
1970
2011
}
1971
2012
1972
- var element = value ; // Attempt to render the Server Component.
2013
+ var element = value ;
2014
+
2015
+ {
2016
+ var debugInfo = value . _debugInfo ;
2017
+
2018
+ if ( debugInfo ) {
2019
+ // If this came from Flight, forward any debug info into this new row.
2020
+ if ( debugID === null ) {
2021
+ // We don't have a chunk to assign debug info. We need to outline this
2022
+ // component to assign it an ID.
2023
+ return outlineTask ( request , task ) ;
2024
+ } else {
2025
+ // Forward any debug info we have the first time we see it.
2026
+ forwardDebugInfo ( request , debugID , debugInfo ) ;
2027
+ }
2028
+ }
2029
+ } // Attempt to render the Server Component.
1973
2030
1974
2031
return renderElement (
1975
2032
request ,
@@ -1982,9 +2039,32 @@ if (__DEV__) {
1982
2039
}
1983
2040
1984
2041
case REACT_LAZY_TYPE : {
1985
- var payload = value . _payload ;
1986
- var init = value . _init ;
2042
+ // Reset the task's thenable state before continuing. If there was one, it was
2043
+ // from suspending the lazy before.
2044
+ task . thenableState = null ;
2045
+ var lazy = value ;
2046
+ var payload = lazy . _payload ;
2047
+ var init = lazy . _init ;
1987
2048
var resolvedModel = init ( payload ) ;
2049
+
2050
+ {
2051
+ var _debugInfo = lazy . _debugInfo ;
2052
+
2053
+ if ( _debugInfo ) {
2054
+ // If this came from Flight, forward any debug info into this new row.
2055
+ if ( debugID === null ) {
2056
+ // We don't have a chunk to assign debug info. We need to outline this
2057
+ // component to assign it an ID.
2058
+ return outlineTask ( request , task ) ;
2059
+ } else {
2060
+ // Forward any debug info we have the first time we see it.
2061
+ // We do this after init so that we have received all the debug info
2062
+ // from the server by the time we emit it.
2063
+ forwardDebugInfo ( request , debugID , _debugInfo ) ;
2064
+ }
2065
+ }
2066
+ }
2067
+
1988
2068
return renderModelDestructive (
1989
2069
request ,
1990
2070
task ,
@@ -2310,6 +2390,13 @@ if (__DEV__) {
2310
2390
request . completedRegularChunks . push ( processedChunk ) ;
2311
2391
}
2312
2392
2393
+ function forwardDebugInfo ( request , id , debugInfo ) {
2394
+ for ( var i = 0 ; i < debugInfo . length ; i ++ ) {
2395
+ request . pendingChunks ++ ;
2396
+ emitDebugChunk ( request , id , debugInfo [ i ] ) ;
2397
+ }
2398
+ }
2399
+
2313
2400
var emptyRoot = { } ;
2314
2401
2315
2402
function retryTask ( request , task ) {
@@ -2578,7 +2665,9 @@ if (__DEV__) {
2578
2665
var request = createRequest (
2579
2666
model ,
2580
2667
null ,
2581
- options ? options . onError : undefined
2668
+ options ? options . onError : undefined ,
2669
+ undefined ,
2670
+ undefined
2582
2671
) ;
2583
2672
startWork ( request ) ;
2584
2673
startFlowing ( request , destination ) ;
0 commit comments