Skip to content

Commit

Permalink
Allow forms to skip hydration of hidden inputs (#26735)
Browse files Browse the repository at this point in the history
This allows us to emit extra ephemeral data that will only be used on
server rendered forms.

First I refactored the shouldSkip functions to now just do that work
inside the canHydrate methods. This makes the Config bindings a little
less surface area but it also helps us optimize a bit since we now can
look at the code together and find shared paths.

canHydrate returns the instance if it matches, that used to just be
there to refine the type but it can also be used to just return a
different instance later that we find. If we don't find one, we'll bail
out and error regardless so no need to skip past anything.

DiffTrain build for commit 67f4fb0.
  • Loading branch information
sebmarkbage committed May 1, 2023
1 parent b25979b commit d68b806
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23918,7 +23918,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-next-8ea96ef84-20230501";
var ReactVersion = "18.3.0-next-67f4fb021-20230501";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8623,7 +8623,7 @@ var devToolsConfig$jscomp$inline_1039 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-next-8ea96ef84-20230501",
version: "18.3.0-next-67f4fb021-20230501",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1238 = {
Expand Down Expand Up @@ -8654,7 +8654,7 @@ var internals$jscomp$inline_1238 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-8ea96ef84-20230501"
reconcilerVersion: "18.3.0-next-67f4fb021-20230501"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1239 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9049,7 +9049,7 @@ var devToolsConfig$jscomp$inline_1081 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-next-8ea96ef84-20230501",
version: "18.3.0-next-67f4fb021-20230501",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1279 = {
Expand Down Expand Up @@ -9080,7 +9080,7 @@ var internals$jscomp$inline_1279 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-8ea96ef84-20230501"
reconcilerVersion: "18.3.0-next-67f4fb021-20230501"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1280 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-next-8ea96ef84-20230501";
var ReactVersion = "18.3.0-next-67f4fb021-20230501";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,4 +645,4 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-next-8ea96ef84-20230501";
exports.version = "18.3.0-next-67f4fb021-20230501";
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-next-8ea96ef84-20230501";
exports.version = "18.3.0-next-67f4fb021-20230501";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8ea96ef84d8f08ed1846dec9e8ed20d2225db0d3
67f4fb02130b1fe1856289e3b66bb0b8cca57ff7
Original file line number Diff line number Diff line change
Expand Up @@ -27228,7 +27228,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-next-8ea96ef84-20230501";
var ReactVersion = "18.3.0-next-67f4fb021-20230501";

function createPortal$1(
children,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9490,7 +9490,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1063 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "18.3.0-next-8ea96ef84-20230501",
version: "18.3.0-next-67f4fb021-20230501",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
Expand Down Expand Up @@ -9532,7 +9532,7 @@ var internals$jscomp$inline_1301 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-8ea96ef84-20230501"
reconcilerVersion: "18.3.0-next-67f4fb021-20230501"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1302 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10199,7 +10199,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1141 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "18.3.0-next-8ea96ef84-20230501",
version: "18.3.0-next-67f4fb021-20230501",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
Expand Down Expand Up @@ -10254,7 +10254,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-8ea96ef84-20230501"
reconcilerVersion: "18.3.0-next-67f4fb021-20230501"
});
exports.createPortal = function (children, containerTag) {
return createPortal$1(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27741,7 +27741,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-next-8ea96ef84-20230501";
var ReactVersion = "18.3.0-next-67f4fb021-20230501";

function createPortal$1(
children,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9749,7 +9749,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1118 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "18.3.0-next-8ea96ef84-20230501",
version: "18.3.0-next-67f4fb021-20230501",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
Expand Down Expand Up @@ -9791,7 +9791,7 @@ var internals$jscomp$inline_1370 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-8ea96ef84-20230501"
reconcilerVersion: "18.3.0-next-67f4fb021-20230501"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1371 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10458,7 +10458,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1196 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "18.3.0-next-8ea96ef84-20230501",
version: "18.3.0-next-67f4fb021-20230501",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
Expand Down Expand Up @@ -10513,7 +10513,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-8ea96ef84-20230501"
reconcilerVersion: "18.3.0-next-67f4fb021-20230501"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
computeComponentStackForErrorReporting: function (reactTag) {
Expand Down

0 comments on commit d68b806

Please sign in to comment.