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

Function tryStreamTask

packages/react-server/src/ReactFlightServer.js:5750–5768  ·  view source on GitHub ↗
(request: Request, task: Task)

Source from the content-addressed store, hash-verified

5748}
5749
5750function tryStreamTask(request: Request, task: Task): void {
5751 // This is used to try to emit something synchronously but if it suspends,
5752 // we emit a reference to a new outlined task immediately instead.
5753 const prevCanEmitDebugInfo = canEmitDebugInfo;
5754 if (__DEV__) {
5755 // We can't emit debug into to a specific row of a stream task. Instead we leave
5756 // it false so that we instead outline the row to get a new canEmitDebugInfo if needed.
5757 canEmitDebugInfo = false;
5758 }
5759 const parentSerializedSize = serializedSize;
5760 try {
5761 emitChunk(request, task, task.model);
5762 } finally {
5763 serializedSize = parentSerializedSize;
5764 if (__DEV__) {
5765 canEmitDebugInfo = prevCanEmitDebugInfo;
5766 }
5767 }
5768}
5769
5770function performWork(request: Request): void {
5771 markAsyncSequenceRootTask();

Callers 1

progressFunction · 0.85

Calls 1

emitChunkFunction · 0.85

Tested by

no test coverage detected