Skip to content

Commit

Permalink
Update ReactDebugInfo types to declare timing info separately
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Dec 9, 2024
1 parent 76d603a commit 90abb21
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
8 changes: 7 additions & 1 deletion packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ import type {
RejectedThenable,
ReactDebugInfo,
ReactComponentInfo,
ReactEnvironmentInfo,
ReactAsyncInfo,
ReactTimeInfo,
ReactStackTrace,
ReactCallSite,
} from 'shared/ReactTypes';
Expand Down Expand Up @@ -3244,7 +3246,11 @@ function emitModelChunk(request: Request, id: number, json: string): void {
function emitDebugChunk(
request: Request,
id: number,
debugInfo: ReactComponentInfo | ReactAsyncInfo,
debugInfo:
| ReactComponentInfo
| ReactAsyncInfo
| ReactEnvironmentInfo
| ReactTimeInfo,
): void {
if (!__DEV__) {
// These errors should never make it into a build so we don't need to encode them in codes.json
Expand Down
20 changes: 16 additions & 4 deletions packages/shared/ReactTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export type ReactCallSite = [
export type ReactStackTrace = Array<ReactCallSite>;

export type ReactComponentInfo = {
+name?: string,
+name: string,
+env?: string,
+key?: null | string,
+owner?: null | ReactComponentInfo,
Expand All @@ -199,10 +199,22 @@ export type ReactComponentInfo = {
+debugTask?: null | ConsoleTask,
};

export type ReactEnvironmentInfo = {
+env: string,
};

export type ReactAsyncInfo = {
+started?: number,
+completed?: number,
+type: string,
// Stashed Data for the Specific Execution Environment. Not part of the transport protocol
+debugStack?: null | Error,
+debugTask?: null | ConsoleTask,
+stack?: null | ReactStackTrace,
};

export type ReactDebugInfo = Array<ReactComponentInfo | ReactAsyncInfo>;
export type ReactTimeInfo = {
+time: number, // performance.now
};

export type ReactDebugInfo = Array<
ReactComponentInfo | ReactEnvironmentInfo | ReactAsyncInfo | ReactTimeInfo,
>;

0 comments on commit 90abb21

Please sign in to comment.