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

Function finishedSegment

packages/react-server/src/ReactFizzServer.js:4995–5014  ·  view source on GitHub ↗
(
  request: Request,
  boundary: Root | SuspenseBoundary,
  segment: Segment,
)

Source from the content-addressed store, hash-verified

4993}
4994
4995function finishedSegment(
4996 request: Request,
4997 boundary: Root | SuspenseBoundary,
4998 segment: Segment,
4999) {
5000 if (byteLengthOfChunk !== null) {
5001 // Count the bytes of all the chunks of this segment.
5002 const chunks = segment.chunks;
5003 let segmentByteSize = 0;
5004 for (let i = 0; i < chunks.length; i++) {
5005 segmentByteSize += byteLengthOfChunk(chunks[i]);
5006 }
5007 // Accumulate on the parent boundary to power heuristics.
5008 if (boundary === null) {
5009 request.byteSize += segmentByteSize;
5010 } else {
5011 boundary.byteSize += segmentByteSize;
5012 }
5013 }
5014}
5015
5016function finishedTask(
5017 request: Request,

Callers 5

renderSuspenseBoundaryFunction · 0.85
renderSuspenseListRowsFunction · 0.85
renderPreambleFunction · 0.85
resumeNodeFunction · 0.85
retryRenderTaskFunction · 0.85

Calls 1

byteLengthOfChunkFunction · 0.90

Tested by

no test coverage detected