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

Function abortIterable

packages/react-server/src/ReactFlightServer.js:1300–1321  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1298 }
1299 }
1300 function abortIterable() {
1301 if (streamTask.status !== PENDING) {
1302 return;
1303 }
1304 const signal = request.cacheController.signal;
1305 signal.removeEventListener('abort', abortIterable);
1306 const reason = signal.reason;
1307 if (enableHalt && request.type === PRERENDER) {
1308 request.abortableTasks.delete(streamTask);
1309 haltTask(streamTask, request);
1310 finishHaltedTask(streamTask, request);
1311 } else {
1312 // TODO: Make this use abortTask() instead.
1313 erroredTask(request, streamTask, signal.reason);
1314 enqueueFlush(request);
1315 }
1316 if (typeof (iterator: any).throw === 'function') {
1317 // The iterator protocol doesn't necessarily include this but a generator do.
1318 // $FlowFixMe should be able to pass mixed
1319 iterator.throw(reason).then(error, error);
1320 }
1321 }
1322 request.cacheController.signal.addEventListener('abort', abortIterable);
1323 if (__DEV__) {
1324 callIteratorInDEV(iterator, progress, error);

Callers

nothing calls this directly

Calls 6

haltTaskFunction · 0.85
finishHaltedTaskFunction · 0.85
throwMethod · 0.80
erroredTaskFunction · 0.70
enqueueFlushFunction · 0.70
thenMethod · 0.65

Tested by

no test coverage detected