1967
}
1968
const childNodes = node[2];
1969
const childSlots = node[3];
1970
+ const currentNode = task.node;
1971
task.replay = {nodes: childNodes, slots: childSlots, pendingTasks: 1};
1972
try {
1973
renderElement(
1989
"The tree doesn't match so React will fallback to client rendering.",
1990
);
1991
}
1992
+ task.replay.pendingTasks--;
1993
} catch (x) {
1994
if (
1995
typeof x === 'object' &&
1997
(x === SuspenseException || typeof x.then === 'function')
1998
) {
1999
// Suspend
2000
+ if (task.node === currentNode) {
2001
+ // This same element suspended so we need to pop the replay we just added.
2002
+ task.replay = replay;
2003
+ }
2004
throw x;
2005
}
2006
+ task.replay.pendingTasks--;
2007
// Unlike regular render, we don't terminate the siblings if we error
2008
// during a replay. That's because this component didn't actually error
2009
// in the original prerender. What's unable to complete is the child
2010
// replay nodes which might be Suspense boundaries which are able to
2011
// absorb the error and we can still continue with siblings.
2012
erroredReplay(request, task.blockedBoundary, x, childNodes, childSlots);
2006
- } finally {
2007
- task.replay.pendingTasks--;
2008
- task.replay = replay;
2013
}
2014
+ task.replay = replay;
2015
} else {
2016
// Let's double check that the component type matches.
2017
if (type !== REACT_SUSPENSE_TYPE) {
2375
"The tree doesn't match so React will fallback to client rendering.",
2376
);
2377
}
2378
+ task.replay.pendingTasks--;
2379
} catch (x) {
2380
if (
2381
typeof x === 'object' &&
2385
// Suspend
2386
throw x;
2387
}
2388
+ task.replay.pendingTasks--;
2389
// Unlike regular render, we don't terminate the siblings if we error
2390
// during a replay. That's because this component didn't actually error
2391
// in the original prerender. What's unable to complete is the child
2393
// absorb the error and we can still continue with siblings.
2394
// This is an error, stash the component stack if it is null.
2395
erroredReplay(request, task.blockedBoundary, x, childNodes, childSlots);
2389
- } finally {
2390
- task.replay.pendingTasks--;
2391
- task.replay = replay;
2396
}
2397
+ task.replay = replay;
2398
// We finished rendering this node, so now we can consume this
2399
// slot. This must happen after in case we rerender this task.
2400
replayNodes.splice(j, 1);
2437
// We need to use the non-destructive form so that we can safely pop back
2438
// up and render the sibling if something suspends.
2439
const resumeSegmentID = resumeSlots[i];
2440
+ // TODO: If this errors we should still continue with the next sibling.
2441
if (typeof resumeSegmentID === 'number') {
2442
resumeNode(request, task, resumeSegmentID, node, i);
2443
// We finished rendering this node, so now we can consume this