@@ -108,7 +108,7 @@ import {SuspenseException, getSuspendedThenable} from './ReactFlightThenable';
108
108
initAsyncDebugInfo ( ) ;
109
109
110
110
// Dev-only
111
- type ReactDebugInfo = Array < { + name ? : string } > ;
111
+ type ReactDebugInfo = Array < { + name ? : string , + env ? : string } > ;
112
112
113
113
const ObjectPrototype = Object . prototype ;
114
114
@@ -202,6 +202,8 @@ export type Request = {
202
202
taintCleanupQueue : Array < string | bigint > ,
203
203
onError : ( error : mixed ) => ?string ,
204
204
onPostpone : ( reason : string ) => void ,
205
+ // DEV-only
206
+ environmentName : string ,
205
207
} ;
206
208
207
209
const {
@@ -254,6 +256,7 @@ export function createRequest(
254
256
onError : void | ( ( error : mixed ) => ?string ) ,
255
257
identifierPrefix ?: string ,
256
258
onPostpone : void | ( ( reason : string ) => void ) ,
259
+ environmentName : void | string ,
257
260
) : Request {
258
261
if (
259
262
ReactCurrentCache . current !== null &&
@@ -273,7 +276,7 @@ export function createRequest(
273
276
TaintRegistryPendingRequests . add ( cleanupQueue ) ;
274
277
}
275
278
const hints = createHints ( ) ;
276
- const request : Request = {
279
+ const request : Request = ( {
277
280
status : OPEN ,
278
281
flushScheduled : false ,
279
282
fatalError : null ,
@@ -298,7 +301,11 @@ export function createRequest(
298
301
taintCleanupQueue : cleanupQueue ,
299
302
onError : onError === undefined ? defaultErrorHandler : onError ,
300
303
onPostpone : onPostpone === undefined ? defaultPostponeHandler : onPostpone ,
301
- } ;
304
+ } : any ) ;
305
+ if ( __DEV__ ) {
306
+ request . environmentName =
307
+ environmentName === undefined ? 'server' : environmentName ;
308
+ }
302
309
const rootTask = createTask ( request , model , null , false , abortSet ) ;
303
310
pingedTasks . push ( rootTask ) ;
304
311
return request ;
@@ -519,7 +526,10 @@ function renderFunctionComponent<Props>(
519
526
const componentName =
520
527
( Component : any ) . displayName || Component . name || '' ;
521
528
request . pendingChunks ++ ;
522
- emitDebugChunk ( request , debugID , { name : componentName } ) ;
529
+ emitDebugChunk ( request , debugID , {
530
+ name : componentName ,
531
+ env : request . environmentName ,
532
+ } ) ;
523
533
}
524
534
}
525
535
@@ -1717,7 +1727,7 @@ function emitModelChunk(request: Request, id: number, json: string): void {
1717
1727
function emitDebugChunk(
1718
1728
request: Request,
1719
1729
id: number,
1720
- debugInfo: { + name ? : string } ,
1730
+ debugInfo: { + name ? : string , + env ? : string } ,
1721
1731
): void {
1722
1732
if ( ! __DEV__ ) {
1723
1733
// These errors should never make it into a build so we don't need to encode them in codes.json
0 commit comments