Repository: facebook/react
Pull request: Clean up empty string special cases

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

Changed files:
filename: packages/react-dom-bindings/src/client/ReactDOMComponent.js
patch: @@ -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;
     }

filename: packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
patch: @@ -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,

filename: packages/react-reconciler/src/ReactFiberConfigWithNoHydration.js
patch: @@ -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;

filename: packages/react-reconciler/src/ReactFiberHydrationContext.js
patch: @@ -74,7 +74,6 @@ import {
   canHydrateSuspenseInstance,
   canHydrateFormStateMarker,
   isFormStateMarkerMatching,
-  isHydratableText,
   validateHydratableInstance,
   validateHydratableTextInstance,
 } from './ReactFiberConfig';
@@ -517,21 +516,15 @@ 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)) {

filename: packages/react-reconciler/src/forks/ReactFiberConfig.custom.js
patch: @@ -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 =