@@ -11,7 +11,9 @@ import type {
11
11
Thenable,
12
12
ReactDebugInfo,
13
13
ReactComponentInfo,
14
+ ReactEnvironmentInfo,
14
15
ReactAsyncInfo,
16
+ ReactTimeInfo,
15
17
ReactStackTrace,
16
18
ReactCallSite,
17
19
} from 'shared/ReactTypes';
@@ -2471,7 +2473,11 @@ function initializeFakeStack(
2471
2473
function resolveDebugInfo(
2472
2474
response: Response,
2473
2475
id: number,
2474
- debugInfo: ReactComponentInfo | ReactAsyncInfo,
2476
+ debugInfo:
2477
+ | ReactComponentInfo
2478
+ | ReactEnvironmentInfo
2479
+ | ReactAsyncInfo
2480
+ | ReactTimeInfo,
2475
2481
): void {
2476
2482
if (!__DEV__) {
2477
2483
// 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(
2485
2491
// to initialize it when we need it, we might be inside user code.
2486
2492
const env =
2487
2493
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
+ }
2489
2500
if (debugInfo.owner === null && response._debugRootOwner != null) {
2490
2501
// $FlowFixMe[prop-missing] By narrowing `owner` to `null`, we narrowed `debugInfo` to `ReactComponentInfo`
2491
2502
const componentInfo: ReactComponentInfo = debugInfo;
@@ -2495,8 +2506,11 @@ function resolveDebugInfo(
2495
2506
// was created on the server isn't very useful but where the request was made is.
2496
2507
// $FlowFixMe[cannot-write]
2497
2508
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);
2500
2514
}
2501
2515
2502
2516
const chunk = getChunk(response, id);
@@ -2780,11 +2794,19 @@ function processFullStringRow(
2780
2794
}
2781
2795
case 68 /* "D" */: {
2782
2796
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);
2785
2803
initializeModelChunk(chunk);
2786
- const initializedChunk: SomeChunk<ReactComponentInfo | ReactAsyncInfo> =
2787
- chunk;
2804
+ const initializedChunk: SomeChunk<
2805
+ | ReactComponentInfo
2806
+ | ReactEnvironmentInfo
2807
+ | ReactAsyncInfo
2808
+ | ReactTimeInfo,
2809
+ > = chunk;
2788
2810
if (initializedChunk.status === INITIALIZED) {
2789
2811
resolveDebugInfo(response, id, initializedChunk.value);
2790
2812
} else {
0 commit comments