4829
}
4830
}
4831
4832
+function abortUnwoundTask(task: Task, request: Request): void {
4833
+ // This task was rendering when abort began, so the synchronous abort sweep
4834
+ // left it alone. It has now unwound from user code and can be completed
4835
+ // through the normal abort path.
4836
+ if (__DEV__) {
4837
+ abortTaskDEV(task, request);
4838
+ } else {
4839
+ abortTask(task, request);
4840
+ }
4841
+ task.abortSet.delete(task);
4842
+ if (__DEV__) {
4843
+ finishAbortedTaskDEV(task, request, request.fatalError);
4844
+ } else {
4845
+ finishAbortedTask(task, request, request.fatalError);
4846
+ }
4847
+}
4848
+
4849
function safelyEmitEarlyPreloads(
4850
request: Request,
4851
shellComplete: boolean,
5186
// (unstable) API for suspending. This implementation detail can change
5187
// later, once we deprecate the old API in favor of `use`.
5188
getSuspendedThenable()
5172
- : request.aborted
5173
- ? request.fatalError
5174
- : thrownValue;
5175
-
5176
- if (request.aborted && request.trackedPostpones !== null) {
5177
- // We are aborting a prerender and need to halt this task.
5178
- const trackedPostpones = request.trackedPostpones;
5179
- const thrownInfo = getThrownInfo(task.componentStack);
5180
- task.abortSet.delete(task);
5181
-
5182
- logRecoverableError(
5183
- request,
5184
- x,
5185
- thrownInfo,
5186
- __DEV__ ? task.debugTask : null,
5187
- );
5189
+ : thrownValue;
5190
5189
- trackPostpone(request, trackedPostpones, task, segment);
5190
- finishedTask(request, task.blockedBoundary, task.row, segment);
5191
+ if (request.aborted) {
5192
+ if (thrownValue === SuspenseException) {
5193
+ // This task was rendering when abort() was called, so it never took
5194
+ // the normal suspension path below that stores the thenable state.
5195
+ // Preserve it before finishing the abort so DEV can replay the task
5196
+ // and include this suspended use() call site in the owner stack.
5197
+ task.thenableState = getThenableStateAfterSuspending();
5198
+ }
5199
+ // The task has unwound from user code, so it must no longer appear to
5200
+ // be the currently rendering task while we synchronously finish it.
5201
+ // Restore the parent instead of clearing this field because finishing
5202
+ // can reenter Fizz and abort an outer render that is still on the stack.
5203
+ request.currentTask = prevTask;
5204
+ abortUnwoundTask(task, request);
5205
return;
5206
}
5207
5294
getSuspendedThenable()
5295
: thrownValue;
5296
5297
+ if (request.aborted) {
5298
+ if (thrownValue === SuspenseException) {
5299
+ // This task was rendering when abort() was called, so it never took
5300
+ // the normal suspension path below that stores the thenable state.
5301
+ // Preserve it before finishing the abort so DEV can replay the task
5302
+ // and include this suspended use() call site in the owner stack.
5303
+ task.thenableState = getThenableStateAfterSuspending();
5304
+ }
5305
+ // The task has unwound from user code, so it must no longer appear to
5306
+ // be the currently rendering task while we synchronously finish it.
5307
+ // Restore the parent instead of clearing this field because finishing
5308
+ // can reenter Fizz and abort an outer render that is still on the stack.
5309
+ request.currentTask = prevTask;
5310
+ abortUnwoundTask(task, request);
5311
+ return;
5312
+ }
5313
+
5314
if (typeof x === 'object' && x !== null) {
5315
// $FlowFixMe[method-unbinding]
5316
if (typeof x.then === 'function') {