Skip to content

Commit c62bed8

Browse files
committed
Clean up empty string special cases
1 parent b8da12e commit c62bed8

File tree

5 files changed

+4
-24
lines changed

5 files changed

+4
-24
lines changed

packages/react-dom-bindings/src/client/ReactDOMComponent.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2977,13 +2977,6 @@ export function warnForInsertedHydratedText(
29772977
text: string,
29782978
) {
29792979
if (__DEV__) {
2980-
if (text === '') {
2981-
// We expect to insert empty text nodes since they're not represented in
2982-
// the HTML.
2983-
// TODO: Remove this special case if we can just avoid inserting empty
2984-
// text nodes.
2985-
return;
2986-
}
29872980
if (didWarnInvalidHydration) {
29882981
return;
29892982
}

packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,10 +1026,6 @@ export function bindInstance(
10261026

10271027
export const supportsHydration = true;
10281028

1029-
export function isHydratableText(text: string): boolean {
1030-
return text !== '';
1031-
}
1032-
10331029
export function canHydrateInstance(
10341030
instance: HydratableInstance,
10351031
type: string,

packages/react-reconciler/src/ReactFiberConfigWithNoHydration.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ function shim(...args: any): empty {
2121
// Hydration (when unsupported)
2222
export type SuspenseInstance = mixed;
2323
export const supportsHydration = false;
24-
export const isHydratableText = shim;
2524
export const isSuspenseInstancePending = shim;
2625
export const isSuspenseInstanceFallback = shim;
2726
export const getSuspenseInstanceFallbackErrorDetails = shim;

packages/react-reconciler/src/ReactFiberHydrationContext.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ import {
7474
canHydrateSuspenseInstance,
7575
canHydrateFormStateMarker,
7676
isFormStateMarkerMatching,
77-
isHydratableText,
7877
validateHydratableInstance,
7978
validateHydratableTextInstance,
8079
} from './ReactFiberConfig';
@@ -517,21 +516,15 @@ function tryToClaimNextHydratableTextInstance(fiber: Fiber): void {
517516
return;
518517
}
519518
const text = fiber.pendingProps;
520-
const isHydratable = isHydratableText(text);
521519

522520
let shouldKeepWarning = true;
523-
if (isHydratable) {
524-
// Validate that this is ok to render here before any mismatches.
525-
const currentHostContext = getHostContext();
526-
shouldKeepWarning = validateHydratableTextInstance(
527-
text,
528-
currentHostContext,
529-
);
530-
}
521+
// Validate that this is ok to render here before any mismatches.
522+
const currentHostContext = getHostContext();
523+
shouldKeepWarning = validateHydratableTextInstance(text, currentHostContext);
531524

532525
const initialInstance = nextHydratableInstance;
533526
const nextInstance = nextHydratableInstance;
534-
if (!nextInstance || !isHydratable) {
527+
if (!nextInstance) {
535528
// We exclude non hydrabable text because we know there are no matching hydratables.
536529
// We either throw or insert depending on the render mode.
537530
if (shouldClientRenderOnMismatch(fiber)) {

packages/react-reconciler/src/forks/ReactFiberConfig.custom.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ export const cloneHiddenTextInstance = $$$config.cloneHiddenTextInstance;
134134
// Hydration
135135
// (optional)
136136
// -------------------
137-
export const isHydratableText = $$$config.isHydratableText;
138137
export const isSuspenseInstancePending = $$$config.isSuspenseInstancePending;
139138
export const isSuspenseInstanceFallback = $$$config.isSuspenseInstanceFallback;
140139
export const getSuspenseInstanceFallbackErrorDetails =

0 commit comments

Comments
 (0)