@@ -4736,34 +4736,39 @@ export function attach(
47364736 );
47374737
47384738 shouldMeasureSuspenseNode = false;
4739- if (nextFallbackFiber !== null) {
4739+ if (prevFallbackFiber !== null || nextFallbackFiber !== null) {
47404740 const fallbackStashedSuspenseParent = reconcilingParentSuspenseNode;
47414741 const fallbackStashedSuspensePrevious =
47424742 previouslyReconciledSiblingSuspenseNode;
47434743 const fallbackStashedSuspenseRemaining =
47444744 remainingReconcilingChildrenSuspenseNodes;
47454745 // Next, we'll pop back out of the SuspenseNode that we added above and now we'll
4746- // reconcile the fallback, reconciling anything by inserting into the parent SuspenseNode.
4746+ // reconcile the fallback, reconciling anything in the context of the parent SuspenseNode.
47474747 // Since the fallback conceptually blocks the parent.
47484748 reconcilingParentSuspenseNode = stashedSuspenseParent;
47494749 previouslyReconciledSiblingSuspenseNode = stashedSuspensePrevious;
47504750 remainingReconcilingChildrenSuspenseNodes = stashedSuspenseRemaining;
47514751 try {
4752- updateFlags |= updateVirtualChildrenRecursively(
4753- nextFallbackFiber,
4754- null,
4755- prevFallbackFiber,
4756- traceNearestHostComponentUpdate,
4757- 0,
4758- );
4752+ if (nextFallbackFiber === null) {
4753+ unmountRemainingChildren();
4754+ } else {
4755+ updateFlags |= updateVirtualChildrenRecursively(
4756+ nextFallbackFiber,
4757+ null,
4758+ prevFallbackFiber,
4759+ traceNearestHostComponentUpdate,
4760+ 0,
4761+ );
4762+ }
47594763 } finally {
47604764 reconcilingParentSuspenseNode = fallbackStashedSuspenseParent;
47614765 previouslyReconciledSiblingSuspenseNode =
47624766 fallbackStashedSuspensePrevious;
47634767 remainingReconcilingChildrenSuspenseNodes =
47644768 fallbackStashedSuspenseRemaining;
47654769 }
4766- } else if (nextFiber.memoizedState === null) {
4770+ }
4771+ if (nextFiber.memoizedState === null) {
47674772 // Measure this Suspense node in case it changed. We don't update the rect while
47684773 // we're inside a disconnected subtree nor if we are the Suspense boundary that
47694774 // is suspended. This lets us keep the rectangle of the displayed content while
0 commit comments