@@ -11,7 +11,9 @@ import type {
1111 Thenable,
1212 ReactDebugInfo,
1313 ReactComponentInfo,
14+ ReactEnvironmentInfo,
1415 ReactAsyncInfo,
16+ ReactTimeInfo,
1517 ReactStackTrace,
1618 ReactCallSite,
1719} from 'shared/ReactTypes';
@@ -2471,7 +2473,11 @@ function initializeFakeStack(
24712473function resolveDebugInfo(
24722474 response: Response,
24732475 id: number,
2474- debugInfo: ReactComponentInfo | ReactAsyncInfo,
2476+ debugInfo:
2477+ | ReactComponentInfo
2478+ | ReactEnvironmentInfo
2479+ | ReactAsyncInfo
2480+ | ReactTimeInfo,
24752481): void {
24762482 if (!__DEV__) {
24772483 // These errors should never make it into a build so we don't need to encode them in codes.json
@@ -2485,7 +2491,12 @@ function resolveDebugInfo(
24852491 // to initialize it when we need it, we might be inside user code.
24862492 const env =
24872493 debugInfo.env === undefined ? response._rootEnvironmentName : debugInfo.env;
2488- initializeFakeTask(response, debugInfo, env);
2494+ if (debugInfo.stack !== undefined) {
2495+ // $FlowFixMe[incompatible-type]
2496+ const componentInfoOrAsyncInfo: ReactComponentInfo | ReactAsyncInfo =
2497+ debugInfo;
2498+ initializeFakeTask(response, componentInfoOrAsyncInfo, env);
2499+ }
24892500 if (debugInfo.owner === null && response._debugRootOwner != null) {
24902501 // $FlowFixMe[prop-missing] By narrowing `owner` to `null`, we narrowed `debugInfo` to `ReactComponentInfo`
24912502 const componentInfo: ReactComponentInfo = debugInfo;
@@ -2495,8 +2506,11 @@ function resolveDebugInfo(
24952506 // was created on the server isn't very useful but where the request was made is.
24962507 // $FlowFixMe[cannot-write]
24972508 componentInfo.debugStack = response._debugRootStack;
2498- } else {
2499- initializeFakeStack(response, debugInfo);
2509+ } else if (debugInfo.stack !== undefined) {
2510+ // $FlowFixMe[incompatible-type]
2511+ const componentInfoOrAsyncInfo: ReactComponentInfo | ReactAsyncInfo =
2512+ debugInfo;
2513+ initializeFakeStack(response, componentInfoOrAsyncInfo);
25002514 }
25012515
25022516 const chunk = getChunk(response, id);
@@ -2780,11 +2794,19 @@ function processFullStringRow(
27802794 }
27812795 case 68 /* "D" */: {
27822796 if (__DEV__) {
2783- const chunk: ResolvedModelChunk<ReactComponentInfo | ReactAsyncInfo> =
2784- createResolvedModelChunk(response, row);
2797+ const chunk: ResolvedModelChunk<
2798+ | ReactComponentInfo
2799+ | ReactEnvironmentInfo
2800+ | ReactAsyncInfo
2801+ | ReactTimeInfo,
2802+ > = createResolvedModelChunk(response, row);
27852803 initializeModelChunk(chunk);
2786- const initializedChunk: SomeChunk<ReactComponentInfo | ReactAsyncInfo> =
2787- chunk;
2804+ const initializedChunk: SomeChunk<
2805+ | ReactComponentInfo
2806+ | ReactEnvironmentInfo
2807+ | ReactAsyncInfo
2808+ | ReactTimeInfo,
2809+ > = chunk;
27882810 if (initializedChunk.status === INITIALIZED) {
27892811 resolveDebugInfo(response, id, initializedChunk.value);
27902812 } else {
0 commit comments