MCPcopy
hub / github.com/facebook/react / emitDebugChunk

Function emitDebugChunk

packages/react-server/src/ReactFlightServer.js:4243–4270  ·  view source on GitHub ↗
(
  request: Request,
  id: number,
  debugInfo: ReactDebugInfoEntry,
)

Source from the content-addressed store, hash-verified

4241}
4242
4243function emitDebugChunk(
4244 request: Request,
4245 id: number,
4246 debugInfo: ReactDebugInfoEntry,
4247): void {
4248 if (!__DEV__) {
4249 // These errors should never make it into a build so we don't need to encode them in codes.json
4250 // eslint-disable-next-line react-internal/prod-error-codes
4251 throw new Error(
4252 'emitDebugChunk should never be called in production mode. This is a bug in React.',
4253 );
4254 }
4255
4256 const json: string = serializeDebugModel(request, 500, debugInfo);
4257 if (request.debugDestination !== null) {
4258 // Outline the actual timing information to the debug channel.
4259 const outlinedId = request.nextChunkId++;
4260 const debugRow = outlinedId.toString(16) + ':' + json + '\n';
4261 request.pendingDebugChunks++;
4262 request.completedDebugChunks.push(stringToChunk(debugRow));
4263 const row =
4264 serializeRowHeader('D', id) + '"$' + outlinedId.toString(16) + '"\n';
4265 request.completedRegularChunks.push(stringToChunk(row));
4266 } else {
4267 const row = serializeRowHeader('D', id) + json + '\n';
4268 request.completedRegularChunks.push(stringToChunk(row));
4269 }
4270}
4271
4272function outlineComponentInfo(
4273 request: Request,

Callers 6

renderFunctionComponentFunction · 0.85
visitAsyncNodeFunction · 0.85
emitAsyncSequenceFunction · 0.85
forwardDebugInfoFunction · 0.85
retryTaskFunction · 0.85

Calls 5

stringToChunkFunction · 0.90
serializeDebugModelFunction · 0.85
serializeRowHeaderFunction · 0.85
toStringMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected