@@ -4300,14 +4300,21 @@ function emitDebugChunk(
43004300
43014301 const json : string = serializeDebugModel ( request , 500 , debugInfo ) ;
43024302 if ( request . debugDestination !== null ) {
4303- // Outline the actual timing information to the debug channel.
4304- const outlinedId = request . nextChunkId ++ ;
4305- const debugRow = outlinedId . toString ( 16 ) + ':' + json + '\n' ;
4306- request . pendingDebugChunks ++ ;
4307- request . completedDebugChunks . push ( stringToChunk ( debugRow ) ) ;
4308- const row =
4309- serializeRowHeader ( 'D' , id ) + '"$' + outlinedId . toString ( 16 ) + '"\n' ;
4310- request . completedRegularChunks . push ( stringToChunk ( row ) ) ;
4303+ if ( json [ 0 ] === '"' && json [ 1 ] === '$' ) {
4304+ // This is already an outlined reference so we can just emit it directly,
4305+ // without an unnecessary indirection.
4306+ const row = serializeRowHeader ( 'D' , id ) + json + '\n' ;
4307+ request . completedRegularChunks . push ( stringToChunk ( row ) ) ;
4308+ } else {
4309+ // Outline the debug information to the debug channel.
4310+ const outlinedId = request . nextChunkId ++ ;
4311+ const debugRow = outlinedId . toString ( 16 ) + ':' + json + '\n' ;
4312+ request . pendingDebugChunks ++ ;
4313+ request . completedDebugChunks . push ( stringToChunk ( debugRow ) ) ;
4314+ const row =
4315+ serializeRowHeader ( 'D' , id ) + '"$' + outlinedId . toString ( 16 ) + '"\n' ;
4316+ request . completedRegularChunks . push ( stringToChunk ( row ) ) ;
4317+ }
43114318 } else {
43124319 const row = serializeRowHeader ( 'D' , id ) + json + '\n' ;
43134320 request . completedRegularChunks . push ( stringToChunk ( row ) ) ;
0 commit comments