157
enableSuspenseAvoidThisFallbackFizz,
158
enableCache,
159
enablePostpone,
160
+ enableHalt,
161
enableRenderableContext,
162
enableRefAsProp,
163
disableDefaultPropsExceptForClasses,
3626
) {
3627
// Report the error to a global handler.
3628
let errorDigest;
3629
+ // We don't handle halts here because we only halt when prerendering and
3630
+ // when prerendering we should be finishing tasks not erroring them when
3631
+ // they halt or postpone
3632
if (
3633
enablePostpone &&
3634
typeof error === 'object' &&
3816
logRecoverableError(request, fatal, errorInfo, null);
3817
fatalError(request, fatal, errorInfo, null);
3818
}
3819
+ } else if (
3820
+ enableHalt &&
3821
+ request.trackedPostpones !== null &&
3822
+ segment !== null
3823
+ ) {
3824
+ const trackedPostpones = request.trackedPostpones;
3825
+ // We are aborting a prerender and must treat the shell as halted
3826
+ // We log the error but we still resolve the prerender
3827
+ logRecoverableError(request, error, errorInfo, null);
3828
+ trackPostpone(request, trackedPostpones, task, segment);
3829
+ finishedTask(request, null, segment);
3830
} else {
3831
logRecoverableError(request, error, errorInfo, null);
3832
fatalError(request, error, errorInfo, null);
3871
}
3872
} else {
3873
boundary.pendingTasks--;
3874
+ // We construct an errorInfo from the boundary's componentStack so the error in dev will indicate which
3875
+ // boundary the message is referring to
3876
+ const errorInfo = getThrownInfo(task.componentStack);
3877
+ const trackedPostpones = request.trackedPostpones;
3878
if (boundary.status !== CLIENT_RENDERED) {
3860
- // We construct an errorInfo from the boundary's componentStack so the error in dev will indicate which
3861
- // boundary the message is referring to
3862
- const errorInfo = getThrownInfo(task.componentStack);
3879
+ if (enableHalt) {
3880
+ if (trackedPostpones !== null && segment !== null) {
3881
+ // We are aborting a prerender
3882
+ if (
3883
+ enablePostpone &&
3884
+ typeof error === 'object' &&
3885
+ error !== null &&
3886
+ error.$$typeof === REACT_POSTPONE_TYPE
3887
+ ) {
3888
+ const postponeInstance: Postpone = (error: any);
3889
+ logPostpone(request, postponeInstance.message, errorInfo, null);
3890
+ } else {
3891
+ // We are aborting a prerender and must halt this boundary.
3892
+ // We treat this like other postpones during prerendering
3893
+ logRecoverableError(request, error, errorInfo, null);
3894
+ }
3895
+ trackPostpone(request, trackedPostpones, task, segment);
3896
+ // If this boundary was still pending then we haven't already cancelled its fallbacks.
3897
+ // We'll need to abort the fallbacks, which will also error that parent boundary.
3898
+ boundary.fallbackAbortableTasks.forEach(fallbackTask =>
3899
+ abortTask(fallbackTask, request, error),
3900
+ );
3901
+ boundary.fallbackAbortableTasks.clear();
3902
+ return finishedTask(request, boundary, segment);
3903
+ }
3904
+ }
3905
+ boundary.status = CLIENT_RENDERED;
3906
+ // We are aborting a render or resume which should put boundaries
3907
+ // into an explicitly client rendered state
3908
let errorDigest;
3909
if (
3910
enablePostpone &&
4190
? request.fatalError
4191
: thrownValue;
4192
4193
+ if (
4194
+ enableHalt &&
4195
+ request.status === ABORTING &&
4196
+ request.trackedPostpones !== null
4197
+ ) {
4198
+ // We are aborting a prerender and need to halt this task.
4199
+ const trackedPostpones = request.trackedPostpones;
4200
+ const thrownInfo = getThrownInfo(task.componentStack);
4201
+ task.abortSet.delete(task);
4202
+
4203
+ if (
4204
+ enablePostpone &&
4205
+ typeof x === 'object' &&
4206
+ x !== null &&
4207
+ x.$$typeof === REACT_POSTPONE_TYPE
4208
+ ) {
4209
+ const postponeInstance: Postpone = (x: any);
4210
+ logPostpone(
4211
+ request,
4212
+ postponeInstance.message,
4213
+ thrownInfo,
4214
+ __DEV__ && enableOwnerStacks ? task.debugTask : null,
4215
+ );
4216
+ } else {
4217
+ logRecoverableError(
4218
+ request,
4219
+ x,
4220
+ thrownInfo,
4221
+ __DEV__ && enableOwnerStacks ? task.debugTask : null,
4222
+ );
4223
+ }
4224
+
4225
+ trackPostpone(request, trackedPostpones, task, segment);
4226
+ finishedTask(request, task.blockedBoundary, segment);
4227
+ return;
4228
+ }
4229
+
4230
if (typeof x === 'object' && x !== null) {
4231
// $FlowFixMe[method-unbinding]
4232
if (typeof x.then === 'function') {