diff --git a/packages/react-dom-bindings/src/client/ReactDOMComponent.js b/packages/react-dom-bindings/src/client/ReactDOMComponent.js index 24462c1d2bb5a..b5c9f673cfef4 100644 --- a/packages/react-dom-bindings/src/client/ReactDOMComponent.js +++ b/packages/react-dom-bindings/src/client/ReactDOMComponent.js @@ -2977,13 +2977,6 @@ export function warnForInsertedHydratedText( text: string, ) { if (__DEV__) { - 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; } diff --git a/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js b/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js index 973a9fb931246..ebfe403f2315d 100644 --- a/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js +++ b/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js @@ -1026,10 +1026,6 @@ export function bindInstance( export const supportsHydration = true; -export function isHydratableText(text: string): boolean { - return text !== ''; -} - export function canHydrateInstance( instance: HydratableInstance, type: string, diff --git a/packages/react-reconciler/src/ReactFiberConfigWithNoHydration.js b/packages/react-reconciler/src/ReactFiberConfigWithNoHydration.js index 6af759793203c..2413e6d986ac7 100644 --- a/packages/react-reconciler/src/ReactFiberConfigWithNoHydration.js +++ b/packages/react-reconciler/src/ReactFiberConfigWithNoHydration.js @@ -21,7 +21,6 @@ function shim(...args: any): empty { // Hydration (when unsupported) export type SuspenseInstance = mixed; export const supportsHydration = false; -export const isHydratableText = shim; export const isSuspenseInstancePending = shim; export const isSuspenseInstanceFallback = shim; export const getSuspenseInstanceFallbackErrorDetails = shim; diff --git a/packages/react-reconciler/src/ReactFiberHydrationContext.js b/packages/react-reconciler/src/ReactFiberHydrationContext.js index 8960419b80163..d395c0149229b 100644 --- a/packages/react-reconciler/src/ReactFiberHydrationContext.js +++ b/packages/react-reconciler/src/ReactFiberHydrationContext.js @@ -74,7 +74,6 @@ import { canHydrateSuspenseInstance, canHydrateFormStateMarker, isFormStateMarkerMatching, - isHydratableText, validateHydratableInstance, validateHydratableTextInstance, } from './ReactFiberConfig'; @@ -517,21 +516,18 @@ function tryToClaimNextHydratableTextInstance(fiber: Fiber): void { return; } const text = fiber.pendingProps; - const isHydratable = isHydratableText(text); let shouldKeepWarning = true; - if (isHydratable) { - // Validate that this is ok to render here before any mismatches. - const currentHostContext = getHostContext(); - shouldKeepWarning = validateHydratableTextInstance( - text, - currentHostContext, - ); - } + // Validate that this is ok to render here before any mismatches. + const currentHostContext = getHostContext(); + shouldKeepWarning = validateHydratableTextInstance( + text, + currentHostContext, + ); const initialInstance = nextHydratableInstance; const 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)) { diff --git a/packages/react-reconciler/src/forks/ReactFiberConfig.custom.js b/packages/react-reconciler/src/forks/ReactFiberConfig.custom.js index 8e6c96bd4fe0a..c2c6fd21e5987 100644 --- a/packages/react-reconciler/src/forks/ReactFiberConfig.custom.js +++ b/packages/react-reconciler/src/forks/ReactFiberConfig.custom.js @@ -134,7 +134,6 @@ export const cloneHiddenTextInstance = $$$config.cloneHiddenTextInstance; // Hydration // (optional) // ------------------- -export const isHydratableText = $$$config.isHydratableText; export const isSuspenseInstancePending = $$$config.isSuspenseInstancePending; export const isSuspenseInstanceFallback = $$$config.isSuspenseInstanceFallback; export const getSuspenseInstanceFallbackErrorDetails =