76
requestStorage,
77
pushFormStateMarkerIsMatching,
78
pushFormStateMarkerIsNotMatching,
79
+ resetResumableState,
80
} from './ReactFizzConfig';
81
import {
82
constructClassInstance,
506
onFatalError: onFatalError === undefined ? noop : onFatalError,
507
formState: null,
508
};
509
+ if (typeof postponedState.replaySlots === 'number') {
510
+ const resumedId = postponedState.replaySlots;
511
+ // We have a resume slot at the very root. This is effectively just a full rerender.
512
+ const rootSegment = createPendingSegment(
513
+ request,
514
+ 0,
515
+ null,
516
+ postponedState.rootFormatContext,
517
+ // Root segments are never embedded in Text on either edge
518
+ false,
519
+ false,
520
+ );
521
+ rootSegment.id = resumedId;
522
+ // There is no parent so conceptually, we're unblocked to flush this segment.
523
+ rootSegment.parentFlushed = true;
524
+ const rootTask = createRenderTask(
525
+ request,
526
+ null,
527
+ children,
528
+ -1,
529
+ null,
530
+ rootSegment,
531
+ abortSet,
532
+ null,
533
+ postponedState.rootFormatContext,
534
+ emptyContextObject,
535
+ rootContextSnapshot,
536
+ emptyTreeContext,
537
+ );
538
+ pingedTasks.push(rootTask);
539
+ return request;
540
+ }
541
+
542
const replay: ReplaySet = {
543
nodes: postponedState.replayNodes,
544
slots: postponedState.replaySlots,
2511
2512
const keyPath = task.keyPath;
2513
const boundary = task.blockedBoundary;
2514
+
2515
+ if (boundary === null) {
2516
+ segment.id = request.nextSegmentId++;
2517
+ trackedPostpones.rootSlots = segment.id;
2518
+ if (request.completedRootSegment !== null) {
2519
+ // Postpone the root if this was a deeper segment.
2520
+ request.completedRootSegment.status = POSTPONED;
2521
+ }
2522
+ return;
2523
+ }
2524
+
2525
if (boundary !== null && boundary.status === PENDING) {
2526
boundary.status = POSTPONED;
2527
// We need to eagerly assign it an ID because we'll need to refer to
2880
enablePostpone &&
2881
request.trackedPostpones !== null &&
2882
x.$$typeof === REACT_POSTPONE_TYPE &&
2838
- task.blockedBoundary !== null // TODO: Support holes in the shell
2883
+ task.blockedBoundary !== null // bubble if we're postponing in the shell
2884
) {
2885
// If we're tracking postpones, we inject a hole here and continue rendering
2886
// sibling. Similar to suspending. If we're not tracking, we treat it more like
3421
} else if (
3422
enablePostpone &&
3423
request.trackedPostpones !== null &&
3379
- x.$$typeof === REACT_POSTPONE_TYPE &&
3380
- task.blockedBoundary !== null // TODO: Support holes in the shell
3424
+ x.$$typeof === REACT_POSTPONE_TYPE
3425
) {
3426
// If we're tracking postpones, we mark this segment as postponed and finish
3427
// the task without filling it in. If we're not tracking, we treat it more like
3914
let i;
3915
const completedRootSegment = request.completedRootSegment;
3916
if (completedRootSegment !== null) {
3873
- if (request.pendingRootTasks === 0) {
3917
+ if (completedRootSegment.status === POSTPONED) {
3918
+ // We postponed the root, so we write nothing.
3919
+ return;
3920
+ } else if (request.pendingRootTasks === 0) {
3921
if (enableFloat) {
3922
writePreamble(
3923
destination,
4185
request.trackedPostpones = null;
4186
return null;
4187
}
4188
+ if (
4189
+ request.completedRootSegment !== null &&
4190
+ request.completedRootSegment.status === POSTPONED
4191
+ ) {
4192
+ // We postponed the root so we didn't flush anything.
4193
+ resetResumableState(request.resumableState, request.renderState);
4194
+ }
4195
return {
4196
nextSegmentId: request.nextSegmentId,
4197
rootFormatContext: request.rootFormatContext,