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

Function injectPostponedHole

packages/react-server/src/ReactFizzServer.js:4036–4060  ·  view source on GitHub ↗
(
  request: Request,
  task: RenderTask,
  reason: string,
  thrownInfo: ThrownInfo,
)

Source from the content-addressed store, hash-verified

4034}
4035
4036function injectPostponedHole(
4037 request: Request,
4038 task: RenderTask,
4039 reason: string,
4040 thrownInfo: ThrownInfo,
4041): Segment {
4042 logPostpone(request, reason, thrownInfo, __DEV__ ? task.debugTask : null);
4043 // Something suspended, we'll need to create a new segment and resolve it later.
4044 const segment = task.blockedSegment;
4045 const insertionIndex = segment.chunks.length;
4046 const newSegment = createPendingSegment(
4047 request,
4048 insertionIndex,
4049 null,
4050 task.formatContext,
4051 // Adopt the parent segment's leading text embed
4052 segment.lastPushedText,
4053 // Assume we are text embedded at the trailing edge
4054 true,
4055 );
4056 segment.children.push(newSegment);
4057 // Reset lastPushedText for current Segment since the new Segment "consumed" it
4058 segment.lastPushedText = false;
4059 return newSegment;
4060}
4061
4062function spawnNewSuspendedReplayTask(
4063 request: Request,

Callers 1

renderNodeFunction · 0.85

Calls 3

createPendingSegmentFunction · 0.85
logPostponeFunction · 0.70
pushMethod · 0.65

Tested by

no test coverage detected