Skip to content

Commit b444393

Browse files
committed
Don't add undefined properties when forwarding
Maybe we should keep the nulls.
1 parent 9573247 commit b444393

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

packages/react-server/src/ReactFlightServer.js

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3614,18 +3614,24 @@ function outlineComponentInfo(
36143614
'debugTask' | 'debugStack',
36153615
> = {
36163616
name: componentInfo.name,
3617-
env: componentInfo.env,
36183617
key: componentInfo.key,
3619-
owner: componentInfo.owner,
36203618
};
3619+
if (componentInfo.env != null) {
3620+
// $FlowFixMe[cannot-write]
3621+
componentDebugInfo.env = componentInfo.env;
3622+
}
3623+
if (componentInfo.owner != null) {
3624+
// $FlowFixMe[cannot-write]
3625+
componentDebugInfo.owner = componentInfo.owner;
3626+
}
36213627
if (componentInfo.stack == null && componentInfo.debugStack != null) {
36223628
// If we have a debugStack but no parsed stack we should parse it.
36233629
// $FlowFixMe[cannot-write]
36243630
componentDebugInfo.stack = filterStackTrace(
36253631
request,
36263632
parseStackTrace(componentInfo.debugStack, 1),
36273633
);
3628-
} else {
3634+
} else if (componentInfo.stack != null) {
36293635
// $FlowFixMe[cannot-write]
36303636
componentDebugInfo.stack = componentInfo.stack;
36313637
}
@@ -4337,10 +4343,19 @@ function forwardDebugInfo(
43374343
'debugTask' | 'debugStack',
43384344
> = {
43394345
awaited: ioInfo,
4340-
env: info.env,
4341-
owner: info.owner,
4342-
stack: debugStack,
43434346
};
4347+
if (info.env != null) {
4348+
// $FlowFixMe[cannot-write]
4349+
debugAsyncInfo.env = info.env;
4350+
}
4351+
if (info.owner != null) {
4352+
// $FlowFixMe[cannot-write]
4353+
debugAsyncInfo.owner = info.owner;
4354+
}
4355+
if (debugStack != null) {
4356+
// $FlowFixMe[cannot-write]
4357+
debugAsyncInfo.stack = debugStack;
4358+
}
43444359
emitDebugChunk(request, id, debugAsyncInfo);
43454360
}
43464361
} else {

0 commit comments

Comments
 (0)