Skip to content

Commit

Permalink
[Fizz] Add resumeAndPrerender to Static Rendering (#30950)
Browse files Browse the repository at this point in the history
This is only in the same experimental exports as `resume`. Useful with
Postpone/Halt.

We already have `prerender()` to create a partial tree with postponed
state. We also have `resume()` to dynamically resume such a tree.

This lets you do a new prerender by resuming an already existing
postponed state. Basically creating a chain of preludes. The next
prelude would include the scripts to patch up the document.

This mostly just works since both prerender and resume are already
implemented using the same code so we just enable both at the root. I'm
sure we'll find some edge cases since this wasn't considered when it was
first written but so far I've only found an unrelated existing bug with
`keyPath` fixed here.

DiffTrain build for [4735220](4735220)
  • Loading branch information
sebmarkbage committed Sep 12, 2024
1 parent ed8cad4 commit fadd1ee
Show file tree
Hide file tree
Showing 36 changed files with 92 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 @@
d6cb4e771341ff82489c00f4907990cb8a75696b
473522093d3dd95582729d01cd5c0d15dcc9cd3b
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d6cb4e771341ff82489c00f4907990cb8a75696b
473522093d3dd95582729d01cd5c0d15dcc9cd3b
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-d6cb4e77-20240911";
exports.version = "19.0.0-www-classic-47352209-20240912";
"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-d6cb4e77-20240911";
exports.version = "19.0.0-www-modern-47352209-20240912";
"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-d6cb4e77-20240911";
exports.version = "19.0.0-www-classic-47352209-20240912";
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-d6cb4e77-20240911";
exports.version = "19.0.0-www-modern-47352209-20240912";
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-d6cb4e77-20240911";
exports.version = "19.0.0-www-classic-47352209-20240912";
"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-d6cb4e77-20240911";
exports.version = "19.0.0-www-modern-47352209-20240912";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17062,11 +17062,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-classic-d6cb4e77-20240911",
version: "19.0.0-www-classic-47352209-20240912",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-www-classic-d6cb4e77-20240911"
reconcilerVersion: "19.0.0-www-classic-47352209-20240912"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -17100,7 +17100,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-classic-d6cb4e77-20240911";
exports.version = "19.0.0-www-classic-47352209-20240912";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16508,11 +16508,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-modern-d6cb4e77-20240911",
version: "19.0.0-www-modern-47352209-20240912",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-www-modern-d6cb4e77-20240911"
reconcilerVersion: "19.0.0-www-modern-47352209-20240912"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -16546,7 +16546,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-modern-d6cb4e77-20240911";
exports.version = "19.0.0-www-modern-47352209-20240912";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10852,13 +10852,13 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1417 = {
bundleType: 0,
version: "19.0.0-www-classic-d6cb4e77-20240911",
version: "19.0.0-www-classic-47352209-20240912",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function () {
return null;
},
reconcilerVersion: "19.0.0-www-classic-d6cb4e77-20240911"
reconcilerVersion: "19.0.0-www-classic-47352209-20240912"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1418 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10884,4 +10884,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-classic-d6cb4e77-20240911";
exports.version = "19.0.0-www-classic-47352209-20240912";
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -10366,13 +10366,13 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1409 = {
bundleType: 0,
version: "19.0.0-www-modern-d6cb4e77-20240911",
version: "19.0.0-www-modern-47352209-20240912",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function () {
return null;
},
reconcilerVersion: "19.0.0-www-modern-d6cb4e77-20240911"
reconcilerVersion: "19.0.0-www-modern-47352209-20240912"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1410 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10398,4 +10398,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-modern-d6cb4e77-20240911";
exports.version = "19.0.0-www-modern-47352209-20240912";
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -27802,11 +27802,11 @@ __DEV__ &&
: flushSyncErrorInBuildsThatSupportLegacyMode;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-www-classic-d6cb4e77-20240911" !== isomorphicReactPackageVersion)
if ("19.0.0-www-classic-47352209-20240912" !== 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-d6cb4e77-20240911\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.0.0-www-classic-47352209-20240912\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -27850,11 +27850,11 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-classic-d6cb4e77-20240911",
version: "19.0.0-www-classic-47352209-20240912",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-www-classic-d6cb4e77-20240911"
reconcilerVersion: "19.0.0-www-classic-47352209-20240912"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -28507,7 +28507,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-d6cb4e77-20240911";
exports.version = "19.0.0-www-classic-47352209-20240912";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -26919,11 +26919,11 @@ __DEV__ &&
return_targetInst = null;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-www-modern-d6cb4e77-20240911" !== isomorphicReactPackageVersion)
if ("19.0.0-www-modern-47352209-20240912" !== 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-d6cb4e77-20240911\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.0.0-www-modern-47352209-20240912\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -26966,11 +26966,11 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-modern-d6cb4e77-20240911",
version: "19.0.0-www-modern-47352209-20240912",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-www-modern-d6cb4e77-20240911"
reconcilerVersion: "19.0.0-www-modern-47352209-20240912"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -27575,7 +27575,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-d6cb4e77-20240911";
exports.version = "19.0.0-www-modern-47352209-20240912";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17402,14 +17402,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1760 = React.version;
if (
"19.0.0-www-classic-d6cb4e77-20240911" !==
"19.0.0-www-classic-47352209-20240912" !==
isomorphicReactPackageVersion$jscomp$inline_1760
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1760,
"19.0.0-www-classic-d6cb4e77-20240911"
"19.0.0-www-classic-47352209-20240912"
)
);
function flushSyncFromReconciler(fn) {
Expand Down Expand Up @@ -17454,11 +17454,11 @@ Internals.Events = [
];
var internals$jscomp$inline_2254 = {
bundleType: 0,
version: "19.0.0-www-classic-d6cb4e77-20240911",
version: "19.0.0-www-classic-47352209-20240912",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-www-classic-d6cb4e77-20240911"
reconcilerVersion: "19.0.0-www-classic-47352209-20240912"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2255 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17914,4 +17914,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-d6cb4e77-20240911";
exports.version = "19.0.0-www-classic-47352209-20240912";
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16778,14 +16778,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1731 = React.version;
if (
"19.0.0-www-modern-d6cb4e77-20240911" !==
"19.0.0-www-modern-47352209-20240912" !==
isomorphicReactPackageVersion$jscomp$inline_1731
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1731,
"19.0.0-www-modern-d6cb4e77-20240911"
"19.0.0-www-modern-47352209-20240912"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -16803,11 +16803,11 @@ Internals.Events = [
];
var internals$jscomp$inline_2245 = {
bundleType: 0,
version: "19.0.0-www-modern-d6cb4e77-20240911",
version: "19.0.0-www-modern-47352209-20240912",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-www-modern-d6cb4e77-20240911"
reconcilerVersion: "19.0.0-www-modern-47352209-20240912"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2246 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17170,4 +17170,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-d6cb4e77-20240911";
exports.version = "19.0.0-www-modern-47352209-20240912";
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -18162,14 +18162,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1850 = React.version;
if (
"19.0.0-www-classic-d6cb4e77-20240911" !==
"19.0.0-www-classic-47352209-20240912" !==
isomorphicReactPackageVersion$jscomp$inline_1850
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1850,
"19.0.0-www-classic-d6cb4e77-20240911"
"19.0.0-www-classic-47352209-20240912"
)
);
function flushSyncFromReconciler(fn) {
Expand Down Expand Up @@ -18214,11 +18214,11 @@ Internals.Events = [
];
var internals$jscomp$inline_1857 = {
bundleType: 0,
version: "19.0.0-www-classic-d6cb4e77-20240911",
version: "19.0.0-www-classic-47352209-20240912",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-www-classic-d6cb4e77-20240911"
reconcilerVersion: "19.0.0-www-classic-47352209-20240912"
};
enableSchedulingProfiler &&
((internals$jscomp$inline_1857.getLaneLabelMap = getLaneLabelMap),
Expand Down Expand Up @@ -18677,7 +18677,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-d6cb4e77-20240911";
exports.version = "19.0.0-www-classic-47352209-20240912";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
10 changes: 5 additions & 5 deletions compiled/facebook-www/ReactDOM-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -17521,14 +17521,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1821 = React.version;
if (
"19.0.0-www-modern-d6cb4e77-20240911" !==
"19.0.0-www-modern-47352209-20240912" !==
isomorphicReactPackageVersion$jscomp$inline_1821
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1821,
"19.0.0-www-modern-d6cb4e77-20240911"
"19.0.0-www-modern-47352209-20240912"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -17546,11 +17546,11 @@ Internals.Events = [
];
var internals$jscomp$inline_1823 = {
bundleType: 0,
version: "19.0.0-www-modern-d6cb4e77-20240911",
version: "19.0.0-www-modern-47352209-20240912",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-www-modern-d6cb4e77-20240911"
reconcilerVersion: "19.0.0-www-modern-47352209-20240912"
};
enableSchedulingProfiler &&
((internals$jscomp$inline_1823.getLaneLabelMap = getLaneLabelMap),
Expand Down Expand Up @@ -17916,7 +17916,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-d6cb4e77-20240911";
exports.version = "19.0.0-www-modern-47352209-20240912";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
3 changes: 2 additions & 1 deletion compiled/facebook-www/ReactDOMServer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -5834,6 +5834,7 @@ __DEV__ &&
resumedBoundary.rootSegmentID = ref;
task.blockedBoundary = resumedBoundary;
task.hoistableState = resumedBoundary.contentState;
task.keyPath = keyPath;
task.replay = {
nodes: replay,
slots: name,
Expand Down Expand Up @@ -8985,5 +8986,5 @@ __DEV__ &&
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "19.0.0-www-classic-d6cb4e77-20240911";
exports.version = "19.0.0-www-classic-47352209-20240912";
})();
Loading

0 comments on commit fadd1ee

Please sign in to comment.