Skip to content

Commit 2e12fd8

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

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

packages/react-client/src/ReactFlightClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2658,7 +2658,7 @@ function resolveDebugInfo(
26582658
// to initialize it when we need it, we might be inside user code.
26592659
initializeFakeTask(response, componentInfoOrAsyncInfo);
26602660
}
2661-
if (debugInfo.owner === null && response._debugRootOwner != null) {
2661+
if (debugInfo.owner == null && response._debugRootOwner != null) {
26622662
const componentInfoOrAsyncInfo: ReactComponentInfo | ReactAsyncInfo =
26632663
// $FlowFixMe: By narrowing `owner` to `null`, we narrowed `debugInfo` to `ReactComponentInfo`
26642664
debugInfo;

packages/react-server/src/ReactFlightServer.js

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3587,18 +3587,24 @@ function outlineComponentInfo(
35873587
'debugTask' | 'debugStack',
35883588
> = {
35893589
name: componentInfo.name,
3590-
env: componentInfo.env,
35913590
key: componentInfo.key,
3592-
owner: componentInfo.owner,
35933591
};
3592+
if (componentInfo.env != null) {
3593+
// $FlowFixMe[cannot-write]
3594+
componentDebugInfo.env = componentInfo.env;
3595+
}
3596+
if (componentInfo.owner != null) {
3597+
// $FlowFixMe[cannot-write]
3598+
componentDebugInfo.owner = componentInfo.owner;
3599+
}
35943600
if (componentInfo.stack == null && componentInfo.debugStack != null) {
35953601
// If we have a debugStack but no parsed stack we should parse it.
35963602
// $FlowFixMe[cannot-write]
35973603
componentDebugInfo.stack = filterStackTrace(
35983604
request,
35993605
parseStackTrace(componentInfo.debugStack, 1),
36003606
);
3601-
} else {
3607+
} else if (componentInfo.stack != null) {
36023608
// $FlowFixMe[cannot-write]
36033609
componentDebugInfo.stack = componentInfo.stack;
36043610
}
@@ -4293,10 +4299,19 @@ function forwardDebugInfo(
42934299
const debugAsyncInfo: Omit<ReactAsyncInfo, 'debugTask' | 'debugStack'> =
42944300
{
42954301
awaited: ioInfo,
4296-
env: info.env,
4297-
owner: info.owner,
4298-
stack: debugStack,
42994302
};
4303+
if (info.env != null) {
4304+
// $FlowFixMe[cannot-write]
4305+
debugAsyncInfo.env = info.env;
4306+
}
4307+
if (info.owner != null) {
4308+
// $FlowFixMe[cannot-write]
4309+
debugAsyncInfo.owner = info.owner;
4310+
}
4311+
if (debugStack != null) {
4312+
// $FlowFixMe[cannot-write]
4313+
debugAsyncInfo.stack = debugStack;
4314+
}
43004315
emitDebugChunk(request, id, debugAsyncInfo);
43014316
} else {
43024317
emitDebugChunk(request, id, debugInfo[i]);

0 commit comments

Comments
 (0)