Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't serialize chunk ids for Hint and Console rows #31671

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,8 @@ function patchConsole(consoleInst: typeof console, methodName: string) {
1,
);
request.pendingChunks++;
// We don't currently use this id for anything but we emit it so that we can later
// refer to previous logs in debug info to associate them with a component.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't do this. Instead, we associate the log with the component via the owner passed to the console chunk.

const id = request.nextChunkId++;
const owner: null | ReactComponentInfo = resolveOwner();
emitConsoleChunk(request, id, methodName, owner, stack, arguments);
emitConsoleChunk(request, methodName, owner, stack, arguments);
}
// $FlowFixMe[prop-missing]
return originalMethod.apply(this, arguments);
Expand Down Expand Up @@ -3227,8 +3224,7 @@ function emitHintChunk<Code: HintCode>(
model: HintModel<Code>,
): void {
const json: string = stringify(model);
const id = request.nextChunkId++;
const row = serializeRowHeader('H' + code, id) + json + '\n';
const row = ':H' + code + json + '\n';
const processedChunk = stringToChunk(row);
request.completedHintChunks.push(processedChunk);
}
Expand Down Expand Up @@ -3764,7 +3760,6 @@ function outlineConsoleValue(

function emitConsoleChunk(
request: Request,
id: number,
methodName: string,
owner: null | ReactComponentInfo,
stackTrace: ReactStackTrace,
Expand Down Expand Up @@ -3828,7 +3823,7 @@ function emitConsoleChunk(
replacer,
);
}
const row = serializeRowHeader('W', id) + json + '\n';
const row = ':W' + json + '\n';
const processedChunk = stringToChunk(row);
request.completedRegularChunks.push(processedChunk);
}
Expand Down
Loading