From 7d5492cc0ef9a9f2e5c7ee1d33b28c5a5702ca5e Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Wed, 4 Dec 2024 19:39:01 -0500 Subject: [PATCH 1/2] Don't serialize chunk ids for Hint rows --- packages/react-server/src/ReactFlightServer.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/react-server/src/ReactFlightServer.js b/packages/react-server/src/ReactFlightServer.js index 8b69c7a8036ef..90c0678f8fdae 100644 --- a/packages/react-server/src/ReactFlightServer.js +++ b/packages/react-server/src/ReactFlightServer.js @@ -3227,8 +3227,7 @@ function emitHintChunk( model: HintModel, ): 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); } From ebad34c25fde8b6e354258ad395f382341f4d044 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Wed, 4 Dec 2024 19:40:51 -0500 Subject: [PATCH 2/2] Don't serialize chunk ids for Console rows --- packages/react-server/src/ReactFlightServer.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/react-server/src/ReactFlightServer.js b/packages/react-server/src/ReactFlightServer.js index 90c0678f8fdae..9f15eabe0d029 100644 --- a/packages/react-server/src/ReactFlightServer.js +++ b/packages/react-server/src/ReactFlightServer.js @@ -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. - 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); @@ -3763,7 +3760,6 @@ function outlineConsoleValue( function emitConsoleChunk( request: Request, - id: number, methodName: string, owner: null | ReactComponentInfo, stackTrace: ReactStackTrace, @@ -3827,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); }