Clean up empty string special cases (#28475)

This was fixed in https://github.com/facebook/react/pull/22807 so we
don't need these special cases anymore.

DiffTrain build for [bb4b147da9](https://github.com/facebook/react/commit/bb4b147da9a892529995f55f15f19f46a00cf4f6)
This commit is contained in:
rickhanlonii
2024-03-01 01:31:25 +00:00
parent b45dfdeccb
commit df4b99cde1
14 changed files with 88 additions and 164 deletions
+1 -1
View File
@@ -1 +1 @@
e7849b50bcefc0742ca342d70284d82cfcf990e5
bb4b147da9a892529995f55f15f19f46a00cf4f6
+1 -1
View File
@@ -633,4 +633,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-classic-d4b2bc87";
exports.version = "18.3.0-www-classic-46c2f9a3";
@@ -637,7 +637,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-classic-012fabe8";
exports.version = "18.3.0-www-classic-4f385f77";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
+1 -1
View File
@@ -66,7 +66,7 @@ if (__DEV__) {
return self;
}
var ReactVersion = "18.3.0-www-modern-78796c31";
var ReactVersion = "18.3.0-www-modern-0bd008ad";
var LegacyRoot = 0;
var ConcurrentRoot = 1;
+8 -24
View File
@@ -8566,22 +8566,17 @@ if (__DEV__) {
}
var text = fiber.pendingProps;
var isHydratable = isHydratableText(text);
var shouldKeepWarning = true;
if (isHydratable) {
// Validate that this is ok to render here before any mismatches.
var currentHostContext = getHostContext();
shouldKeepWarning = validateHydratableTextInstance(
text,
currentHostContext
);
}
var shouldKeepWarning = true; // Validate that this is ok to render here before any mismatches.
var currentHostContext = getHostContext();
shouldKeepWarning = validateHydratableTextInstance(
text,
currentHostContext
);
var initialInstance = nextHydratableInstance;
var nextInstance = nextHydratableInstance;
if (!nextInstance || !isHydratable) {
if (!nextInstance) {
// We exclude non hydrabable text because we know there are no matching hydratables.
// We either throw or insert depending on the render mode.
if (shouldClientRenderOnMismatch(fiber)) {
@@ -36053,7 +36048,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-www-classic-0bf4f6f1";
var ReactVersion = "18.3.0-www-classic-d2fdad5d";
function createPortal$1(
children,
@@ -43787,14 +43782,6 @@ if (__DEV__) {
}
function warnForInsertedHydratedText(parentNode, text) {
{
if (text === "") {
// We expect to insert empty text nodes since they're not represented in
// the HTML.
// TODO: Remove this special case if we can just avoid inserting empty
// text nodes.
return;
}
if (didWarnInvalidHydration) {
return;
}
@@ -44652,9 +44639,6 @@ if (__DEV__) {
return;
} // Making this so we can eventually move all of the instance caching to the commit phase.
function isHydratableText(text) {
return text !== "";
}
function canHydrateInstance(instance, type, props, inRootOrSingleton) {
while (instance.nodeType === ELEMENT_NODE) {
var element = instance;
+8 -24
View File
@@ -8517,22 +8517,17 @@ if (__DEV__) {
}
var text = fiber.pendingProps;
var isHydratable = isHydratableText(text);
var shouldKeepWarning = true;
if (isHydratable) {
// Validate that this is ok to render here before any mismatches.
var currentHostContext = getHostContext();
shouldKeepWarning = validateHydratableTextInstance(
text,
currentHostContext
);
}
var shouldKeepWarning = true; // Validate that this is ok to render here before any mismatches.
var currentHostContext = getHostContext();
shouldKeepWarning = validateHydratableTextInstance(
text,
currentHostContext
);
var initialInstance = nextHydratableInstance;
var nextInstance = nextHydratableInstance;
if (!nextInstance || !isHydratable) {
if (!nextInstance) {
// We exclude non hydrabable text because we know there are no matching hydratables.
// We either throw or insert depending on the render mode.
if (shouldClientRenderOnMismatch(fiber)) {
@@ -35889,7 +35884,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-www-modern-8ea39922";
var ReactVersion = "18.3.0-www-modern-9166f5c5";
function createPortal$1(
children,
@@ -44424,14 +44419,6 @@ if (__DEV__) {
}
function warnForInsertedHydratedText(parentNode, text) {
{
if (text === "") {
// We expect to insert empty text nodes since they're not represented in
// the HTML.
// TODO: Remove this special case if we can just avoid inserting empty
// text nodes.
return;
}
if (didWarnInvalidHydration) {
return;
}
@@ -45289,9 +45276,6 @@ if (__DEV__) {
return;
} // Making this so we can eventually move all of the instance caching to the commit phase.
function isHydratableText(text) {
return text !== "";
}
function canHydrateInstance(instance, type, props, inRootOrSingleton) {
while (instance.nodeType === ELEMENT_NODE) {
var element = instance;
+11 -13
View File
@@ -11758,9 +11758,7 @@ beginWork = function (current, workInProgress, renderLanes) {
return (
null === current &&
isHydrating &&
(((Component = "" !== workInProgress.pendingProps),
(current = renderLanes = nextHydratableInstance),
current && Component)
(((current = renderLanes = nextHydratableInstance), current)
? tryHydrateText(workInProgress, current) ||
(shouldClientRenderOnMismatch(workInProgress) &&
throwOnHydrationMismatch(),
@@ -17229,10 +17227,10 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1819 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-ff9af76d",
version: "18.3.0-www-classic-90d46209",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2179 = {
var internals$jscomp$inline_2178 = {
bundleType: devToolsConfig$jscomp$inline_1819.bundleType,
version: devToolsConfig$jscomp$inline_1819.version,
rendererPackageName: devToolsConfig$jscomp$inline_1819.rendererPackageName,
@@ -17259,19 +17257,19 @@ var internals$jscomp$inline_2179 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-ff9af76d"
reconcilerVersion: "18.3.0-www-classic-90d46209"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2180 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_2179 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_2180.isDisabled &&
hook$jscomp$inline_2180.supportsFiber
!hook$jscomp$inline_2179.isDisabled &&
hook$jscomp$inline_2179.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_2180.inject(
internals$jscomp$inline_2179
(rendererID = hook$jscomp$inline_2179.inject(
internals$jscomp$inline_2178
)),
(injectedHook = hook$jscomp$inline_2180);
(injectedHook = hook$jscomp$inline_2179);
} catch (err) {}
}
assign(Internals, {
@@ -17602,4 +17600,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "18.3.0-www-classic-ff9af76d";
exports.version = "18.3.0-www-classic-90d46209";
+11 -13
View File
@@ -11576,9 +11576,7 @@ beginWork = function (current, workInProgress, renderLanes) {
return (
null === current &&
isHydrating &&
(((Component = "" !== workInProgress.pendingProps),
(current = renderLanes = nextHydratableInstance),
current && Component)
(((current = renderLanes = nextHydratableInstance), current)
? tryHydrateText(workInProgress, current) ||
(shouldClientRenderOnMismatch(workInProgress) &&
throwOnHydrationMismatch(),
@@ -16745,10 +16743,10 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1778 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-7d36ed41",
version: "18.3.0-www-modern-2d6dd0ff",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2143 = {
var internals$jscomp$inline_2142 = {
bundleType: devToolsConfig$jscomp$inline_1778.bundleType,
version: devToolsConfig$jscomp$inline_1778.version,
rendererPackageName: devToolsConfig$jscomp$inline_1778.rendererPackageName,
@@ -16776,19 +16774,19 @@ var internals$jscomp$inline_2143 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-7d36ed41"
reconcilerVersion: "18.3.0-www-modern-2d6dd0ff"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2144 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_2143 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_2144.isDisabled &&
hook$jscomp$inline_2144.supportsFiber
!hook$jscomp$inline_2143.isDisabled &&
hook$jscomp$inline_2143.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_2144.inject(
internals$jscomp$inline_2143
(rendererID = hook$jscomp$inline_2143.inject(
internals$jscomp$inline_2142
)),
(injectedHook = hook$jscomp$inline_2144);
(injectedHook = hook$jscomp$inline_2143);
} catch (err) {}
}
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
@@ -17047,4 +17045,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "18.3.0-www-modern-7d36ed41";
exports.version = "18.3.0-www-modern-2d6dd0ff";
@@ -12493,9 +12493,7 @@ beginWork = function (current, workInProgress, renderLanes) {
return (
null === current &&
isHydrating &&
(((Component = "" !== workInProgress.pendingProps),
(current = renderLanes = nextHydratableInstance),
current && Component)
(((current = renderLanes = nextHydratableInstance), current)
? tryHydrateText(workInProgress, current) ||
(shouldClientRenderOnMismatch(workInProgress) &&
throwOnHydrationMismatch(),
@@ -17998,7 +17996,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1904 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-316d7d0d",
version: "18.3.0-www-classic-124c1c92",
rendererPackageName: "react-dom"
};
(function (internals) {
@@ -18042,7 +18040,7 @@ var devToolsConfig$jscomp$inline_1904 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-316d7d0d"
reconcilerVersion: "18.3.0-www-classic-124c1c92"
});
assign(Internals, {
ReactBrowserEventEmitter: {
@@ -18372,7 +18370,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "18.3.0-www-classic-316d7d0d";
exports.version = "18.3.0-www-classic-124c1c92";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -12305,9 +12305,7 @@ beginWork = function (current, workInProgress, renderLanes) {
return (
null === current &&
isHydrating &&
(((Component = "" !== workInProgress.pendingProps),
(current = renderLanes = nextHydratableInstance),
current && Component)
(((current = renderLanes = nextHydratableInstance), current)
? tryHydrateText(workInProgress, current) ||
(shouldClientRenderOnMismatch(workInProgress) &&
throwOnHydrationMismatch(),
@@ -17508,7 +17506,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1863 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-78796c31",
version: "18.3.0-www-modern-0bd008ad",
rendererPackageName: "react-dom"
};
(function (internals) {
@@ -17553,7 +17551,7 @@ var devToolsConfig$jscomp$inline_1863 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-78796c31"
reconcilerVersion: "18.3.0-www-modern-0bd008ad"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
exports.createPortal = function (children, container) {
@@ -17811,7 +17809,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "18.3.0-www-modern-78796c31";
exports.version = "18.3.0-www-modern-0bd008ad";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -8703,22 +8703,17 @@ if (__DEV__) {
}
var text = fiber.pendingProps;
var isHydratable = isHydratableText(text);
var shouldKeepWarning = true;
if (isHydratable) {
// Validate that this is ok to render here before any mismatches.
var currentHostContext = getHostContext();
shouldKeepWarning = validateHydratableTextInstance(
text,
currentHostContext
);
}
var shouldKeepWarning = true; // Validate that this is ok to render here before any mismatches.
var currentHostContext = getHostContext();
shouldKeepWarning = validateHydratableTextInstance(
text,
currentHostContext
);
var initialInstance = nextHydratableInstance;
var nextInstance = nextHydratableInstance;
if (!nextInstance || !isHydratable) {
if (!nextInstance) {
// We exclude non hydrabable text because we know there are no matching hydratables.
// We either throw or insert depending on the render mode.
if (shouldClientRenderOnMismatch(fiber)) {
@@ -36677,7 +36672,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-www-classic-d4b2bc87";
var ReactVersion = "18.3.0-www-classic-46c2f9a3";
function createPortal$1(
children,
@@ -44411,14 +44406,6 @@ if (__DEV__) {
}
function warnForInsertedHydratedText(parentNode, text) {
{
if (text === "") {
// We expect to insert empty text nodes since they're not represented in
// the HTML.
// TODO: Remove this special case if we can just avoid inserting empty
// text nodes.
return;
}
if (didWarnInvalidHydration) {
return;
}
@@ -45276,9 +45263,6 @@ if (__DEV__) {
return;
} // Making this so we can eventually move all of the instance caching to the commit phase.
function isHydratableText(text) {
return text !== "";
}
function canHydrateInstance(instance, type, props, inRootOrSingleton) {
while (instance.nodeType === ELEMENT_NODE) {
var element = instance;
@@ -8654,22 +8654,17 @@ if (__DEV__) {
}
var text = fiber.pendingProps;
var isHydratable = isHydratableText(text);
var shouldKeepWarning = true;
if (isHydratable) {
// Validate that this is ok to render here before any mismatches.
var currentHostContext = getHostContext();
shouldKeepWarning = validateHydratableTextInstance(
text,
currentHostContext
);
}
var shouldKeepWarning = true; // Validate that this is ok to render here before any mismatches.
var currentHostContext = getHostContext();
shouldKeepWarning = validateHydratableTextInstance(
text,
currentHostContext
);
var initialInstance = nextHydratableInstance;
var nextInstance = nextHydratableInstance;
if (!nextInstance || !isHydratable) {
if (!nextInstance) {
// We exclude non hydrabable text because we know there are no matching hydratables.
// We either throw or insert depending on the render mode.
if (shouldClientRenderOnMismatch(fiber)) {
@@ -36513,7 +36508,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-www-modern-917f3f1b";
var ReactVersion = "18.3.0-www-modern-2bd3a85e";
function createPortal$1(
children,
@@ -45048,14 +45043,6 @@ if (__DEV__) {
}
function warnForInsertedHydratedText(parentNode, text) {
{
if (text === "") {
// We expect to insert empty text nodes since they're not represented in
// the HTML.
// TODO: Remove this special case if we can just avoid inserting empty
// text nodes.
return;
}
if (didWarnInvalidHydration) {
return;
}
@@ -45913,9 +45900,6 @@ if (__DEV__) {
return;
} // Making this so we can eventually move all of the instance caching to the commit phase.
function isHydratableText(text) {
return text !== "";
}
function canHydrateInstance(instance, type, props, inRootOrSingleton) {
while (instance.nodeType === ELEMENT_NODE) {
var element = instance;
@@ -12030,9 +12030,7 @@ beginWork = function (current, workInProgress, renderLanes) {
return (
null === current &&
isHydrating &&
(((Component = "" !== workInProgress.pendingProps),
(current = renderLanes = nextHydratableInstance),
current && Component)
(((current = renderLanes = nextHydratableInstance), current)
? tryHydrateText(workInProgress, current) ||
(shouldClientRenderOnMismatch(workInProgress) &&
throwOnHydrationMismatch(),
@@ -17558,10 +17556,10 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1824 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-012fabe8",
version: "18.3.0-www-classic-4f385f77",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2191 = {
var internals$jscomp$inline_2190 = {
bundleType: devToolsConfig$jscomp$inline_1824.bundleType,
version: devToolsConfig$jscomp$inline_1824.version,
rendererPackageName: devToolsConfig$jscomp$inline_1824.rendererPackageName,
@@ -17588,19 +17586,19 @@ var internals$jscomp$inline_2191 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-012fabe8"
reconcilerVersion: "18.3.0-www-classic-4f385f77"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2192 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_2191 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_2192.isDisabled &&
hook$jscomp$inline_2192.supportsFiber
!hook$jscomp$inline_2191.isDisabled &&
hook$jscomp$inline_2191.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_2192.inject(
internals$jscomp$inline_2191
(rendererID = hook$jscomp$inline_2191.inject(
internals$jscomp$inline_2190
)),
(injectedHook = hook$jscomp$inline_2192);
(injectedHook = hook$jscomp$inline_2191);
} catch (err) {}
}
assign(Internals, {
@@ -18082,4 +18080,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "18.3.0-www-classic-012fabe8";
exports.version = "18.3.0-www-classic-4f385f77";
@@ -11909,9 +11909,7 @@ beginWork = function (current, workInProgress, renderLanes) {
return (
null === current &&
isHydrating &&
(((Component = "" !== workInProgress.pendingProps),
(current = renderLanes = nextHydratableInstance),
current && Component)
(((current = renderLanes = nextHydratableInstance), current)
? tryHydrateText(workInProgress, current) ||
(shouldClientRenderOnMismatch(workInProgress) &&
throwOnHydrationMismatch(),
@@ -17135,10 +17133,10 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1783 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-f7bc3ef1",
version: "18.3.0-www-modern-df268558",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2154 = {
var internals$jscomp$inline_2153 = {
bundleType: devToolsConfig$jscomp$inline_1783.bundleType,
version: devToolsConfig$jscomp$inline_1783.version,
rendererPackageName: devToolsConfig$jscomp$inline_1783.rendererPackageName,
@@ -17166,19 +17164,19 @@ var internals$jscomp$inline_2154 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-f7bc3ef1"
reconcilerVersion: "18.3.0-www-modern-df268558"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2155 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_2154 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_2155.isDisabled &&
hook$jscomp$inline_2155.supportsFiber
!hook$jscomp$inline_2154.isDisabled &&
hook$jscomp$inline_2154.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_2155.inject(
internals$jscomp$inline_2154
(rendererID = hook$jscomp$inline_2154.inject(
internals$jscomp$inline_2153
)),
(injectedHook = hook$jscomp$inline_2155);
(injectedHook = hook$jscomp$inline_2154);
} catch (err) {}
}
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
@@ -17587,4 +17585,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "18.3.0-www-modern-f7bc3ef1";
exports.version = "18.3.0-www-modern-df268558";