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

Function enqueueFlush

packages/react-server/src/ReactFizzServer.js:6213–6234  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

6211}
6212
6213function enqueueFlush(request: Request): void {
6214 if (
6215 request.flushScheduled === false &&
6216 // If there are pinged tasks we are going to flush anyway after work completes
6217 request.pingedTasks.length === 0 &&
6218 // If there is no destination there is nothing we can flush to. A flush will
6219 // happen when we start flowing again
6220 request.destination !== null
6221 ) {
6222 request.flushScheduled = true;
6223 scheduleWork(() => {
6224 // We need to existence check destination again here because it might go away
6225 // in between the enqueueFlush call and the work execution
6226 const destination = request.destination;
6227 if (destination) {
6228 flushCompletedQueues(request, destination);
6229 } else {
6230 request.flushScheduled = false;
6231 }
6232 });
6233 }
6234}
6235
6236// This function is intented to only be called during the pipe function for the Node builds.
6237// The reason we need this is because `renderToPipeableStream` is the only API which allows

Callers 1

flushResourcesFunction · 0.70

Calls 2

scheduleWorkFunction · 0.90
flushCompletedQueuesFunction · 0.85

Tested by

no test coverage detected