Skip to content

Commit

Permalink
[Fiber] Support Suspense boundaries anywhere (excluding hydration) (#…
Browse files Browse the repository at this point in the history
…32163)

This is a follow up to #32069

In the prior change I updated Fizz to allow you to render Suspense
boundaries at any level within a react-dom application by treating the
document body as the default render scope. This change updates Fiber to
provide similar semantics. Note that this update still does not deliver
hydration so unifying the Fizz and Fiber implementations in a single App
is not possible yet.

The implementation required a rework of the getHostSibling and
getHostParent algorithms. Now most HostSingletons are invisible from a
host positioning perspective. Head is special in that it is a valid host
scope so when you have Placements inside of it, it will act as the
parent. But body, and html, will not directly participate in host
positioning.

Additionally to support flipping to a fallback html, head, and body tag
in a Suspense fallback I updated the offscreen hiding/unhide logic to
pierce through singletons when lookin for matching hidable nod
boundaries anywhere (excluding hydration)

DiffTrain build for [c492f97](c492f97)
  • Loading branch information
gnoff committed Jan 29, 2025
1 parent 4588368 commit 59430f8
Show file tree
Hide file tree
Showing 34 changed files with 4,114 additions and 3,442 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b65afdd0c1f644f3630c4e8cfd9ac264c5ac329f
c492f97541486458ce21653d2669d53d380f0538
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b65afdd0c1f644f3630c4e8cfd9ac264c5ac329f
c492f97541486458ce21653d2669d53d380f0538
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.1.0-www-classic-b65afdd0-20250124";
exports.version = "19.1.0-www-classic-c492f975-20250128";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.1.0-www-modern-b65afdd0-20250124";
exports.version = "19.1.0-www-modern-c492f975-20250128";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-classic-b65afdd0-20250124";
exports.version = "19.1.0-www-classic-c492f975-20250128";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-modern-b65afdd0-20250124";
exports.version = "19.1.0-www-modern-c492f975-20250128";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-classic-b65afdd0-20250124";
exports.version = "19.1.0-www-classic-c492f975-20250128";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-modern-b65afdd0-20250124";
exports.version = "19.1.0-www-modern-c492f975-20250128";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
18 changes: 9 additions & 9 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10380,8 +10380,8 @@ __DEV__ &&
}
finishedRoot.effectDuration += popNestedEffectDurations(current);
break;
case 26:
case 27:
case 26:
case 5:
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
null === current && flags & 4 && commitHostMount(finishedWork);
Expand Down Expand Up @@ -11140,10 +11140,10 @@ __DEV__ &&
? root._visibility & -2
: root._visibility | 1),
suspenseCallback &&
((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden),
null === current ||
(null === current ||
retryQueue ||
root ||
offscreenSubtreeIsHidden ||
offscreenSubtreeWasHidden ||
recursivelyTraverseDisappearLayoutEffects(finishedWork)),
null === finishedWork.memoizedProps ||
"manual" !== finishedWork.memoizedProps.mode)
Expand Down Expand Up @@ -11292,8 +11292,8 @@ __DEV__ &&
);
recursivelyTraverseDisappearLayoutEffects(finishedWork);
break;
case 26:
case 27:
case 26:
case 5:
safelyDetachRef(finishedWork, finishedWork.return);
recursivelyTraverseDisappearLayoutEffects(finishedWork);
Expand Down Expand Up @@ -11367,8 +11367,8 @@ __DEV__ &&
commitClassCallbacks(finishedWork);
safelyAttachRef(finishedWork, finishedWork.return);
break;
case 26:
case 27:
case 26:
case 5:
recursivelyTraverseReappearLayoutEffects(
finishedRoot,
Expand Down Expand Up @@ -16950,10 +16950,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-classic-b65afdd0-20250124",
version: "19.1.0-www-classic-c492f975-20250128",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-b65afdd0-20250124"
reconcilerVersion: "19.1.0-www-classic-c492f975-20250128"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -16987,7 +16987,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-classic-b65afdd0-20250124";
exports.version = "19.1.0-www-classic-c492f975-20250128";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
18 changes: 9 additions & 9 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -10198,8 +10198,8 @@ __DEV__ &&
}
finishedRoot.effectDuration += popNestedEffectDurations(current);
break;
case 26:
case 27:
case 26:
case 5:
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
null === current && flags & 4 && commitHostMount(finishedWork);
Expand Down Expand Up @@ -10958,10 +10958,10 @@ __DEV__ &&
? root._visibility & -2
: root._visibility | 1),
suspenseCallback &&
((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden),
null === current ||
(null === current ||
retryQueue ||
root ||
offscreenSubtreeIsHidden ||
offscreenSubtreeWasHidden ||
recursivelyTraverseDisappearLayoutEffects(finishedWork)),
null === finishedWork.memoizedProps ||
"manual" !== finishedWork.memoizedProps.mode)
Expand Down Expand Up @@ -11110,8 +11110,8 @@ __DEV__ &&
);
recursivelyTraverseDisappearLayoutEffects(finishedWork);
break;
case 26:
case 27:
case 26:
case 5:
safelyDetachRef(finishedWork, finishedWork.return);
recursivelyTraverseDisappearLayoutEffects(finishedWork);
Expand Down Expand Up @@ -11185,8 +11185,8 @@ __DEV__ &&
commitClassCallbacks(finishedWork);
safelyAttachRef(finishedWork, finishedWork.return);
break;
case 26:
case 27:
case 26:
case 5:
recursivelyTraverseReappearLayoutEffects(
finishedRoot,
Expand Down Expand Up @@ -16722,10 +16722,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-modern-b65afdd0-20250124",
version: "19.1.0-www-modern-c492f975-20250128",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-b65afdd0-20250124"
reconcilerVersion: "19.1.0-www-modern-c492f975-20250128"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -16759,7 +16759,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-modern-b65afdd0-20250124";
exports.version = "19.1.0-www-modern-c492f975-20250128";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
18 changes: 9 additions & 9 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -7425,8 +7425,8 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) {
}
}
break;
case 26:
case 27:
case 26:
case 5:
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
flags & 512 && safelyAttachRef(finishedWork, finishedWork.return);
Expand Down Expand Up @@ -8039,10 +8039,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
? root._visibility & -2
: root._visibility | 1),
instance &&
((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden),
null === current ||
(null === current ||
suspenseCallback ||
root ||
offscreenSubtreeIsHidden ||
offscreenSubtreeWasHidden ||
recursivelyTraverseDisappearLayoutEffects(finishedWork)),
null === finishedWork.memoizedProps ||
"manual" !== finishedWork.memoizedProps.mode)
Expand Down Expand Up @@ -8196,8 +8196,8 @@ function recursivelyTraverseDisappearLayoutEffects(parentFiber) {
);
recursivelyTraverseDisappearLayoutEffects(finishedWork);
break;
case 26:
case 27:
case 26:
case 5:
safelyDetachRef(finishedWork, finishedWork.return);
recursivelyTraverseDisappearLayoutEffects(finishedWork);
Expand Down Expand Up @@ -8271,8 +8271,8 @@ function recursivelyTraverseReappearLayoutEffects(
commitClassCallbacks(finishedWork);
safelyAttachRef(finishedWork, finishedWork.return);
break;
case 26:
case 27:
case 26:
case 5:
recursivelyTraverseReappearLayoutEffects(
finishedRoot,
Expand Down Expand Up @@ -10830,10 +10830,10 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1514 = {
bundleType: 0,
version: "19.1.0-www-classic-b65afdd0-20250124",
version: "19.1.0-www-classic-c492f975-20250128",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-b65afdd0-20250124"
reconcilerVersion: "19.1.0-www-classic-c492f975-20250128"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1515 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10859,4 +10859,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-classic-b65afdd0-20250124";
exports.version = "19.1.0-www-classic-c492f975-20250128";
18 changes: 9 additions & 9 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -7184,8 +7184,8 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) {
}
}
break;
case 26:
case 27:
case 26:
case 5:
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
flags & 512 && safelyAttachRef(finishedWork, finishedWork.return);
Expand Down Expand Up @@ -7798,10 +7798,10 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
? root._visibility & -2
: root._visibility | 1),
instance &&
((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden),
null === current ||
(null === current ||
suspenseCallback ||
root ||
offscreenSubtreeIsHidden ||
offscreenSubtreeWasHidden ||
recursivelyTraverseDisappearLayoutEffects(finishedWork)),
null === finishedWork.memoizedProps ||
"manual" !== finishedWork.memoizedProps.mode)
Expand Down Expand Up @@ -7955,8 +7955,8 @@ function recursivelyTraverseDisappearLayoutEffects(parentFiber) {
);
recursivelyTraverseDisappearLayoutEffects(finishedWork);
break;
case 26:
case 27:
case 26:
case 5:
safelyDetachRef(finishedWork, finishedWork.return);
recursivelyTraverseDisappearLayoutEffects(finishedWork);
Expand Down Expand Up @@ -8030,8 +8030,8 @@ function recursivelyTraverseReappearLayoutEffects(
commitClassCallbacks(finishedWork);
safelyAttachRef(finishedWork, finishedWork.return);
break;
case 26:
case 27:
case 26:
case 5:
recursivelyTraverseReappearLayoutEffects(
finishedRoot,
Expand Down Expand Up @@ -10550,10 +10550,10 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1487 = {
bundleType: 0,
version: "19.1.0-www-modern-b65afdd0-20250124",
version: "19.1.0-www-modern-c492f975-20250128",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-b65afdd0-20250124"
reconcilerVersion: "19.1.0-www-modern-c492f975-20250128"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1488 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10579,4 +10579,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-modern-b65afdd0-20250124";
exports.version = "19.1.0-www-modern-c492f975-20250128";
Loading

0 comments on commit 59430f8

Please sign in to comment.