Skip to content

Commit 19b7167

Browse files
authored
[Flight] Forward the current environment when forwarding I/O entries (facebook#34836)
1 parent 73507ec commit 19b7167

File tree

2 files changed

+160
-147
lines changed

2 files changed

+160
-147
lines changed

packages/react-server/src/ReactFlightServer.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4493,14 +4493,20 @@ function outlineIOInfo(request: Request, ioInfo: ReactIOInfo): void {
44934493
} else {
44944494
debugStack = ioInfo.stack;
44954495
}
4496+
let env = ioInfo.env;
4497+
if (env == null) {
4498+
// If we're forwarding IO info from this environment, an empty env is effectively the "client" side.
4499+
// The "client" from the perspective of our client will be this current environment.
4500+
env = (0, request.environmentName)();
4501+
}
44964502
emitIOInfoChunk(
44974503
request,
44984504
id,
44994505
ioInfo.name,
45004506
ioInfo.start,
45014507
ioInfo.end,
45024508
ioInfo.value,
4503-
ioInfo.env,
4509+
env,
45044510
owner,
45054511
debugStack,
45064512
);
@@ -5388,6 +5394,11 @@ function forwardDebugInfo(
53885394
if (info.env != null) {
53895395
// $FlowFixMe[cannot-write]
53905396
debugAsyncInfo.env = info.env;
5397+
} else {
5398+
// If we're forwarding IO info from this environment, an empty env is effectively the "client" side.
5399+
// The "client" from the perspective of our client will be this current environment.
5400+
// $FlowFixMe[cannot-write]
5401+
debugAsyncInfo.env = (0, request.environmentName)();
53915402
}
53925403
if (info.owner != null) {
53935404
// $FlowFixMe[cannot-write]

0 commit comments

Comments
 (0)