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

Function spawnNewSuspendedRenderTask

packages/react-server/src/ReactFizzServer.js:4087–4127  ·  view source on GitHub ↗
(
  request: Request,
  task: RenderTask,
  thenableState: ThenableState | null,
)

Source from the content-addressed store, hash-verified

4085}
4086
4087function spawnNewSuspendedRenderTask(
4088 request: Request,
4089 task: RenderTask,
4090 thenableState: ThenableState | null,
4091): RenderTask {
4092 // Something suspended, we'll need to create a new segment and resolve it later.
4093 const segment = task.blockedSegment;
4094 const insertionIndex = segment.chunks.length;
4095 const newSegment = createPendingSegment(
4096 request,
4097 insertionIndex,
4098 null,
4099 task.formatContext,
4100 // Adopt the parent segment's leading text embed
4101 segment.lastPushedText,
4102 // Assume we are text embedded at the trailing edge
4103 true,
4104 );
4105 segment.children.push(newSegment);
4106 // Reset lastPushedText for current Segment since the new Segment "consumed" it
4107 segment.lastPushedText = false;
4108 return createRenderTask(
4109 request,
4110 thenableState,
4111 task.node,
4112 task.childIndex,
4113 task.blockedBoundary,
4114 newSegment,
4115 task.blockedPreamble,
4116 task.hoistableState,
4117 task.abortSet,
4118 task.keyPath,
4119 task.formatContext,
4120 task.context,
4121 task.treeContext,
4122 task.row,
4123 task.componentStack,
4124 !disableLegacyContext ? task.legacyContext : emptyContextObject,
4125 __DEV__ ? task.debugTask : null,
4126 );
4127}
4128
4129// This is a non-destructive form of rendering a node. If it suspends it spawns
4130// a new task and restores the context of this task to what it was before.

Callers 1

renderNodeFunction · 0.85

Calls 3

createPendingSegmentFunction · 0.85
createRenderTaskFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected