382
didWarnForKey: null | WeakSet<ReactComponentInfo>,
383
};
384
385
-const AbortSigil = {};
386
-
385
const {
386
TaintRegistryObjects,
387
TaintRegistryValues,
592
const digest = logRecoverableError(request, x, null);
593
emitErrorChunk(request, newTask.id, digest, x);
594
}
595
+ newTask.status = ERRORED;
596
+ request.abortableTasks.delete(newTask);
597
return newTask.id;
598
}
599
default: {
650
logPostpone(request, postponeInstance.message, newTask);
651
emitPostponeChunk(request, newTask.id, postponeInstance);
652
} else {
653
- newTask.status = ERRORED;
653
const digest = logRecoverableError(request, reason, newTask);
654
emitErrorChunk(request, newTask.id, digest, reason);
655
}
656
+ newTask.status = ERRORED;
657
request.abortableTasks.delete(newTask);
658
enqueueFlush(request);
659
},
1114
// If we aborted during rendering we should interrupt the render but
1115
// we don't need to provide an error because the renderer will encode
1116
// the abort error as the reason.
1117
- throw AbortSigil;
1117
+ // eslint-disable-next-line no-throw-literal
1118
+ throw null;
1119
}
1120
1121
if (
1617
// lazy initializers are user code and could abort during render
1618
// we don't wan to return any value resolved from the lazy initializer
1619
// if it aborts so we interrupt rendering here
1619
- throw AbortSigil;
1620
+ // eslint-disable-next-line no-throw-literal
1621
+ throw null;
1622
}
1623
return renderElement(
1624
request,
2185
}
2186
}
2187
2186
- if (thrownValue === AbortSigil) {
2188
+ if (request.status === ABORTING) {
2189
task.status = ABORTED;
2190
const errorId: number = (request.fatalError: any);
2191
if (wasReactNode) {
2359
// lazy initializers are user code and could abort during render
2360
// we don't wan to return any value resolved from the lazy initializer
2361
// if it aborts so we interrupt rendering here
2360
- throw AbortSigil;
2362
+ // eslint-disable-next-line no-throw-literal
2363
+ throw null;
2364
}
2365
if (__DEV__) {
2366
const debugInfo: ?ReactDebugInfo = lazy._debugInfo;
3693
}
3694
}
3695
3693
- if (x === AbortSigil) {
3696
+ if (request.status === ABORTING) {
3697
request.abortableTasks.delete(task);
3698
task.status = ABORTED;
3699
const errorId: number = (request.fatalError: any);
3912
// This is called to early terminate a request. It creates an error at all pending tasks.
3913
export function abort(request: Request, reason: mixed): void {
3914
try {
3912
- request.status = ABORTING;
3915
+ if (request.status === OPEN) {
3916
+ request.status = ABORTING;
3917
+ }
3918
const abortableTasks = request.abortableTasks;
3919
// We have tasks to abort. We'll emit one error row and then emit a reference
3920
// to that row from every row that's still remaining.