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

Function queueCompletedSegment

packages/react-server/src/ReactFizzServer.js:4967–4993  ·  view source on GitHub ↗
(
  boundary: SuspenseBoundary,
  segment: Segment,
)

Source from the content-addressed store, hash-verified

4965}
4966
4967function queueCompletedSegment(
4968 boundary: SuspenseBoundary,
4969 segment: Segment,
4970): void {
4971 if (
4972 segment.chunks.length === 0 &&
4973 segment.children.length === 1 &&
4974 segment.children[0].boundary === null &&
4975 segment.children[0].id === -1
4976 ) {
4977 // This is an empty segment. There's nothing to write, so we can instead transfer the ID
4978 // to the child. That way any existing references point to the child.
4979 const childSegment = segment.children[0];
4980 childSegment.id = segment.id;
4981 childSegment.parentFlushed = true;
4982 if (
4983 childSegment.status === COMPLETED ||
4984 childSegment.status === ABORTED ||
4985 childSegment.status === ERRORED
4986 ) {
4987 queueCompletedSegment(boundary, childSegment);
4988 }
4989 } else {
4990 const completedSegments = boundary.completedSegments;
4991 completedSegments.push(segment);
4992 }
4993}
4994
4995function finishedSegment(
4996 request: Request,

Callers 3

renderSuspenseBoundaryFunction · 0.85
resumeNodeFunction · 0.85
finishedTaskFunction · 0.85

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected