Skip to content

Commit

Permalink
Prerender during same pass if blocked anyway (#30879)
Browse files Browse the repository at this point in the history
If something suspends in the shell — i.e. we won't replace the suspended
content with a fallback — we might as well prerender the siblings during
the current render pass, instead of spawning a separate prerender pass.

This is implemented by setting the "is prerendering" flag to true
whenever we suspend in the shell. But only if we haven't already skipped
over some siblings, because if so, then we need to schedule a separate
prerender pass regardless.

DiffTrain build for [66cf2cf](66cf2cf)
  • Loading branch information
acdlite committed Sep 10, 2024
1 parent 4d30e52 commit bf9385a
Show file tree
Hide file tree
Showing 34 changed files with 140 additions and 86 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d160aa0fbb1bd2d00ea8c771c551c9cb5b47f1e9
66cf2cfc8a8c4b09d2b783fd7302ae6b24150935
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d160aa0fbb1bd2d00ea8c771c551c9cb5b47f1e9
66cf2cfc8a8c4b09d2b783fd7302ae6b24150935
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 @@ -2001,7 +2001,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-www-classic-d160aa0f-20240910";
exports.version = "19.0.0-www-classic-66cf2cfc-20240910";
"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 @@ -1981,7 +1981,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-www-modern-d160aa0f-20240910";
exports.version = "19.0.0-www-modern-66cf2cfc-20240910";
"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 @@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-d160aa0f-20240910";
exports.version = "19.0.0-www-classic-66cf2cfc-20240910";
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 @@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-d160aa0f-20240910";
exports.version = "19.0.0-www-modern-66cf2cfc-20240910";
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 @@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-d160aa0f-20240910";
exports.version = "19.0.0-www-classic-66cf2cfc-20240910";
"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 @@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-d160aa0f-20240910";
exports.version = "19.0.0-www-modern-66cf2cfc-20240910";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
9 changes: 6 additions & 3 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12940,6 +12940,9 @@ __DEV__ &&
}
function renderDidSuspendDelayIfPossible() {
workInProgressRootExitStatus = RootSuspendedWithDelay;
workInProgressRootDidSkipSuspendedSiblings ||
0 !== (workInProgressRootRenderLanes & 60) ||
(workInProgressRootIsPrerendering = !0);
(0 === (workInProgressRootSkippedLanes & 134217727) &&
0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) ||
null === workInProgressRoot ||
Expand Down Expand Up @@ -16964,11 +16967,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-classic-d160aa0f-20240910",
version: "19.0.0-www-classic-66cf2cfc-20240910",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-www-classic-d160aa0f-20240910"
reconcilerVersion: "19.0.0-www-classic-66cf2cfc-20240910"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -17002,7 +17005,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-classic-d160aa0f-20240910";
exports.version = "19.0.0-www-classic-66cf2cfc-20240910";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
9 changes: 6 additions & 3 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -12488,6 +12488,9 @@ __DEV__ &&
}
function renderDidSuspendDelayIfPossible() {
workInProgressRootExitStatus = RootSuspendedWithDelay;
workInProgressRootDidSkipSuspendedSiblings ||
0 !== (workInProgressRootRenderLanes & 60) ||
(workInProgressRootIsPrerendering = !0);
(0 === (workInProgressRootSkippedLanes & 134217727) &&
0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) ||
null === workInProgressRoot ||
Expand Down Expand Up @@ -16410,11 +16413,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-modern-d160aa0f-20240910",
version: "19.0.0-www-modern-66cf2cfc-20240910",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-www-modern-d160aa0f-20240910"
reconcilerVersion: "19.0.0-www-modern-66cf2cfc-20240910"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -16448,7 +16451,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-modern-d160aa0f-20240910";
exports.version = "19.0.0-www-modern-66cf2cfc-20240910";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
9 changes: 6 additions & 3 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9582,6 +9582,9 @@ function pushAsyncDispatcher() {
}
function renderDidSuspendDelayIfPossible() {
workInProgressRootExitStatus = 4;
workInProgressRootDidSkipSuspendedSiblings ||
0 !== (workInProgressRootRenderLanes & 60) ||
(workInProgressRootIsPrerendering = !0);
(0 === (workInProgressRootSkippedLanes & 134217727) &&
0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) ||
null === workInProgressRoot ||
Expand Down Expand Up @@ -10781,13 +10784,13 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1422 = {
bundleType: 0,
version: "19.0.0-www-classic-d160aa0f-20240910",
version: "19.0.0-www-classic-66cf2cfc-20240910",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function () {
return null;
},
reconcilerVersion: "19.0.0-www-classic-d160aa0f-20240910"
reconcilerVersion: "19.0.0-www-classic-66cf2cfc-20240910"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1423 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10813,4 +10816,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-classic-d160aa0f-20240910";
exports.version = "19.0.0-www-classic-66cf2cfc-20240910";
9 changes: 6 additions & 3 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9148,6 +9148,9 @@ function pushAsyncDispatcher() {
}
function renderDidSuspendDelayIfPossible() {
workInProgressRootExitStatus = 4;
workInProgressRootDidSkipSuspendedSiblings ||
0 !== (workInProgressRootRenderLanes & 60) ||
(workInProgressRootIsPrerendering = !0);
(0 === (workInProgressRootSkippedLanes & 134217727) &&
0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) ||
null === workInProgressRoot ||
Expand Down Expand Up @@ -10295,13 +10298,13 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1414 = {
bundleType: 0,
version: "19.0.0-www-modern-d160aa0f-20240910",
version: "19.0.0-www-modern-66cf2cfc-20240910",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function () {
return null;
},
reconcilerVersion: "19.0.0-www-modern-d160aa0f-20240910"
reconcilerVersion: "19.0.0-www-modern-66cf2cfc-20240910"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1415 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10327,4 +10330,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-modern-d160aa0f-20240910";
exports.version = "19.0.0-www-modern-66cf2cfc-20240910";
13 changes: 8 additions & 5 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -16130,6 +16130,9 @@ __DEV__ &&
}
function renderDidSuspendDelayIfPossible() {
workInProgressRootExitStatus = RootSuspendedWithDelay;
workInProgressRootDidSkipSuspendedSiblings ||
0 !== (workInProgressRootRenderLanes & 60) ||
(workInProgressRootIsPrerendering = !0);
(0 === (workInProgressRootSkippedLanes & 134217727) &&
0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) ||
null === workInProgressRoot ||
Expand Down Expand Up @@ -27701,11 +27704,11 @@ __DEV__ &&
: flushSyncErrorInBuildsThatSupportLegacyMode;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-www-classic-d160aa0f-20240910" !== isomorphicReactPackageVersion)
if ("19.0.0-www-classic-66cf2cfc-20240910" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.0.0-www-classic-d160aa0f-20240910\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.0.0-www-classic-66cf2cfc-20240910\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -27749,11 +27752,11 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-classic-d160aa0f-20240910",
version: "19.0.0-www-classic-66cf2cfc-20240910",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-www-classic-d160aa0f-20240910"
reconcilerVersion: "19.0.0-www-classic-66cf2cfc-20240910"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -28406,7 +28409,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-d160aa0f-20240910";
exports.version = "19.0.0-www-classic-66cf2cfc-20240910";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
13 changes: 8 additions & 5 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -15598,6 +15598,9 @@ __DEV__ &&
}
function renderDidSuspendDelayIfPossible() {
workInProgressRootExitStatus = RootSuspendedWithDelay;
workInProgressRootDidSkipSuspendedSiblings ||
0 !== (workInProgressRootRenderLanes & 60) ||
(workInProgressRootIsPrerendering = !0);
(0 === (workInProgressRootSkippedLanes & 134217727) &&
0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) ||
null === workInProgressRoot ||
Expand Down Expand Up @@ -26818,11 +26821,11 @@ __DEV__ &&
return_targetInst = null;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-www-modern-d160aa0f-20240910" !== isomorphicReactPackageVersion)
if ("19.0.0-www-modern-66cf2cfc-20240910" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.0.0-www-modern-d160aa0f-20240910\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.0.0-www-modern-66cf2cfc-20240910\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -26865,11 +26868,11 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-modern-d160aa0f-20240910",
version: "19.0.0-www-modern-66cf2cfc-20240910",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-www-modern-d160aa0f-20240910"
reconcilerVersion: "19.0.0-www-modern-66cf2cfc-20240910"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -27474,7 +27477,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-d160aa0f-20240910";
exports.version = "19.0.0-www-modern-66cf2cfc-20240910";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
13 changes: 8 additions & 5 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -11478,6 +11478,9 @@ function pushAsyncDispatcher() {
}
function renderDidSuspendDelayIfPossible() {
workInProgressRootExitStatus = 4;
workInProgressRootDidSkipSuspendedSiblings ||
0 !== (workInProgressRootRenderLanes & 60) ||
(workInProgressRootIsPrerendering = !0);
(0 === (workInProgressRootSkippedLanes & 134217727) &&
0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) ||
null === workInProgressRoot ||
Expand Down Expand Up @@ -17331,14 +17334,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1765 = React.version;
if (
"19.0.0-www-classic-d160aa0f-20240910" !==
"19.0.0-www-classic-66cf2cfc-20240910" !==
isomorphicReactPackageVersion$jscomp$inline_1765
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1765,
"19.0.0-www-classic-d160aa0f-20240910"
"19.0.0-www-classic-66cf2cfc-20240910"
)
);
function flushSyncFromReconciler(fn) {
Expand Down Expand Up @@ -17383,11 +17386,11 @@ Internals.Events = [
];
var internals$jscomp$inline_2259 = {
bundleType: 0,
version: "19.0.0-www-classic-d160aa0f-20240910",
version: "19.0.0-www-classic-66cf2cfc-20240910",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-www-classic-d160aa0f-20240910"
reconcilerVersion: "19.0.0-www-classic-66cf2cfc-20240910"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2260 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17843,4 +17846,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-d160aa0f-20240910";
exports.version = "19.0.0-www-classic-66cf2cfc-20240910";
13 changes: 8 additions & 5 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -11005,6 +11005,9 @@ function pushAsyncDispatcher() {
}
function renderDidSuspendDelayIfPossible() {
workInProgressRootExitStatus = 4;
workInProgressRootDidSkipSuspendedSiblings ||
0 !== (workInProgressRootRenderLanes & 60) ||
(workInProgressRootIsPrerendering = !0);
(0 === (workInProgressRootSkippedLanes & 134217727) &&
0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) ||
null === workInProgressRoot ||
Expand Down Expand Up @@ -16707,14 +16710,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1736 = React.version;
if (
"19.0.0-www-modern-d160aa0f-20240910" !==
"19.0.0-www-modern-66cf2cfc-20240910" !==
isomorphicReactPackageVersion$jscomp$inline_1736
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1736,
"19.0.0-www-modern-d160aa0f-20240910"
"19.0.0-www-modern-66cf2cfc-20240910"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -16732,11 +16735,11 @@ Internals.Events = [
];
var internals$jscomp$inline_2250 = {
bundleType: 0,
version: "19.0.0-www-modern-d160aa0f-20240910",
version: "19.0.0-www-modern-66cf2cfc-20240910",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-www-modern-d160aa0f-20240910"
reconcilerVersion: "19.0.0-www-modern-66cf2cfc-20240910"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2251 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17099,4 +17102,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-d160aa0f-20240910";
exports.version = "19.0.0-www-modern-66cf2cfc-20240910";
Loading

0 comments on commit bf9385a

Please sign in to comment.