Skip to content

Commit 6d94b15

Browse files
committed
only container manipulation when float is off
1 parent 7b71ebe commit 6d94b15

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

packages/react-dom/src/client/ReactDOMRoot.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type {
1515

1616
import {queueExplicitHydrationTarget} from '../events/ReactDOMEventReplaying';
1717
import {REACT_ELEMENT_TYPE} from 'shared/ReactSymbols';
18+
import {enableFloat} from 'shared/ReactFeatureFlags';
1819

1920
export type RootType = {
2021
render(children: ReactNodeList): void,
@@ -118,7 +119,7 @@ ReactDOMHydrationRoot.prototype.render = ReactDOMRoot.prototype.render = functio
118119

119120
const container = root.containerInfo;
120121

121-
if (container.nodeType !== COMMENT_NODE) {
122+
if (!enableFloat && container.nodeType !== COMMENT_NODE) {
122123
const hostInstance = findHostInstanceWithNoPortals(root.current);
123124
if (hostInstance) {
124125
if (hostInstance.parentNode !== container) {

packages/react-reconciler/src/ReactFiberTreeReflection.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
1313

1414
import {get as getInstance} from 'shared/ReactInstanceMap';
1515
import ReactSharedInternals from 'shared/ReactSharedInternals';
16-
import {enableFloat} from 'shared/ReactFeatureFlags';
1716
import getComponentNameFromFiber from 'react-reconciler/src/getComponentNameFromFiber';
1817
import {
1918
ClassComponent,
@@ -24,7 +23,6 @@ import {
2423
SuspenseComponent,
2524
} from './ReactWorkTags';
2625
import {NoFlags, Placement, Hydrating} from './ReactFiberFlags';
27-
import {supportsHydration, isHydratableResource} from './ReactFiberHostConfig';
2826

2927
const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
3028

@@ -276,15 +274,7 @@ export function findCurrentHostFiber(parent: Fiber): Fiber | null {
276274
function findCurrentHostFiberImpl(node: Fiber) {
277275
// Next we'll drill down this component to find the first HostComponent/Text.
278276
if (node.tag === HostComponent || node.tag === HostText) {
279-
if (
280-
enableFloat &&
281-
supportsHydration &&
282-
isHydratableResource(node.type, node.memoizedProps)
283-
) {
284-
// This is a crude opt out of Resources from this search algorithm
285-
} else {
286-
return node;
287-
}
277+
return node;
288278
}
289279

290280
let child = node.child;
@@ -309,15 +299,7 @@ export function findCurrentHostFiberWithNoPortals(parent: Fiber): Fiber | null {
309299
function findCurrentHostFiberWithNoPortalsImpl(node: Fiber) {
310300
// Next we'll drill down this component to find the first HostComponent/Text.
311301
if (node.tag === HostComponent || node.tag === HostText) {
312-
if (
313-
enableFloat &&
314-
supportsHydration &&
315-
isHydratableResource(node.type, node.memoizedProps)
316-
) {
317-
// This is a crude opt out of Resources from this search algorithm
318-
} else {
319-
return node;
320-
}
302+
return node;
321303
}
322304

323305
let child = node.child;

0 commit comments

Comments
 (0)