1110
// on preparing fallbacks if we don't have any more main content to task on.
1111
request.pingedTasks.push(suspendedFallbackTask);
1112
1113
- // TODO: Should this be in the finally?
1113
popComponentStackInDEV(task);
1114
}
1115
1952
if (keyOrIndex !== node[1]) {
1953
continue;
1954
}
1956
- // Let's double check that the component name matches as a precaution.
1957
- if (name !== null && name !== node[0]) {
1958
- throw new Error(
1959
- 'Expected to see a component of type "' +
1960
- name +
1961
- '" in this slot. ' +
1962
- "The tree doesn't match so React will fallback to client rendering.",
1963
- );
1964
- }
1955
if (node.length === 4) {
1956
// Matched a replayable path.
1957
+ // Let's double check that the component name matches as a precaution.
1958
+ if (name !== null && name !== node[0]) {
1959
+ throw new Error(
1960
+ 'Expected the resume to render <' +
1961
+ (node[0]: any) +
1962
+ '> in this slot but instead it rendered <' +
1963
+ name +
1964
+ '>. ' +
1965
+ "The tree doesn't match so React will fallback to client rendering.",
1966
+ );
1967
+ }
1968
const childNodes = node[2];
1969
const childSlots = node[3];
1970
task.replay = {nodes: childNodes, slots: childSlots, pendingTasks: 1};
2010
} else {
2011
// Let's double check that the component type matches.
2012
if (type !== REACT_SUSPENSE_TYPE) {
2013
+ const expectedType = 'Suspense';
2014
throw new Error(
2013
- 'Expected to see a Suspense boundary in this slot. ' +
2015
+ 'Expected the resume to render <' +
2016
+ expectedType +
2017
+ '> in this slot but instead it rendered <' +
2018
+ (getComponentNameFromType(type) || 'Unknown') +
2019
+ '>. ' +
2020
"The tree doesn't match so React will fallback to client rendering.",
2021
);
2022
}
2384
// in the original prerender. What's unable to complete is the child
2385
// replay nodes which might be Suspense boundaries which are able to
2386
// absorb the error and we can still continue with siblings.
2387
+ // This is an error, stash the component stack if it is null.
2388
erroredReplay(request, task.blockedBoundary, x, childNodes, childSlots);
2389
} finally {
2390
task.replay.pendingTasks--;
2856
if (__DEV__) {
2857
task.componentStack = previousComponentStack;
2858
}
2859
+ lastBoundaryErrorComponentStackDev = null;
2860
return;
2861
}
2862
}
2938
errorDigest = logRecoverableError(request, error);
2939
}
2940
if (boundary === null) {
2941
+ lastBoundaryErrorComponentStackDev = null;
2942
fatalError(request, error);
2943
} else {
2944
boundary.pendingTasks--;
2958
// We reuse the same queue for errors.
2959
request.clientRenderedBoundaries.push(boundary);
2960
}
2961
+ } else {
2962
+ lastBoundaryErrorComponentStackDev = null;
2963
}
2964
}
2965
3088
}
3089
3090
if (boundary === null) {
3080
- request.allPendingTasks--;
3091
if (request.status !== CLOSING && request.status !== CLOSED) {
3092
const replay: null | ReplaySet = task.replay;
3093
if (replay === null) {
3095
// the request;
3096
logRecoverableError(request, error);
3097
fatalError(request, error);
3098
+ return;
3099
} else {
3100
// If the shell aborts during a replay, that's not a fatal error. Instead
3101
// we should be able to recover by client rendering all the root boundaries in
3112
errorDigest,
3113
);
3114
}
3115
+ request.pendingRootTasks--;
3116
+ if (request.pendingRootTasks === 0) {
3117
+ request.onShellError = noop;
3118
+ const onShellReady = request.onShellReady;
3119
+ onShellReady();
3120
+ }
3121
}
3122
}
3123
} else {
3154
abortTask(fallbackTask, request, error),
3155
);
3156
boundary.fallbackAbortableTasks.clear();
3157
+ }
3158
3141
- request.allPendingTasks--;
3142
- if (request.allPendingTasks === 0) {
3143
- const onAllReady = request.onAllReady;
3144
- onAllReady();
3145
- }
3159
+ request.allPendingTasks--;
3160
+ if (request.allPendingTasks === 0) {
3161
+ const onAllReady = request.onAllReady;
3162
+ onAllReady();
3163
}
3164
}
3165
3382
logPostpone(request, postponeInstance.message);
3383
trackPostpone(request, trackedPostpones, task, segment);
3384
finishedTask(request, task.blockedBoundary, segment);
3385
+ lastBoundaryErrorComponentStackDev = null;
3386
return;
3387
}
3388
}
3470
task.replay.nodes,
3471
task.replay.slots,
3472
);
3473
+ request.pendingRootTasks--;
3474
+ if (request.pendingRootTasks === 0) {
3475
+ request.onShellError = noop;
3476
+ const onShellReady = request.onShellReady;
3477
+ onShellReady();
3478
+ }
3479
request.allPendingTasks--;
3480
if (request.allPendingTasks === 0) {
3481
const onAllReady = request.onAllReady;