Skip to content

Commit

Permalink
only container manipulation when float is off
Browse files Browse the repository at this point in the history
  • Loading branch information
gnoff committed Aug 12, 2022
1 parent 93f4dba commit df91473
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
3 changes: 2 additions & 1 deletion packages/react-dom/src/client/ReactDOMRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {

import {queueExplicitHydrationTarget} from '../events/ReactDOMEventReplaying';
import {REACT_ELEMENT_TYPE} from 'shared/ReactSymbols';
import {enableFloat} from 'shared/ReactFeatureFlags';

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

const container = root.containerInfo;

if (container.nodeType !== COMMENT_NODE) {
if (!enableFloat && container.nodeType !== COMMENT_NODE) {
const hostInstance = findHostInstanceWithNoPortals(root.current);
if (hostInstance) {
if (hostInstance.parentNode !== container) {
Expand Down
21 changes: 2 additions & 19 deletions packages/react-reconciler/src/ReactFiberTreeReflection.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
SuspenseComponent,
} from './ReactWorkTags';
import {NoFlags, Placement, Hydrating} from './ReactFiberFlags';
import {supportsHydration, isHydratableResource} from './ReactFiberHostConfig';

const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;

Expand Down Expand Up @@ -276,15 +275,7 @@ export function findCurrentHostFiber(parent: Fiber): Fiber | null {
function findCurrentHostFiberImpl(node: Fiber) {
// Next we'll drill down this component to find the first HostComponent/Text.
if (node.tag === HostComponent || node.tag === HostText) {
if (
enableFloat &&
supportsHydration &&
isHydratableResource(node.type, node.memoizedProps)
) {
// This is a crude opt out of Resources from this search algorithm
} else {
return node;
}
return node;
}

let child = node.child;
Expand All @@ -309,15 +300,7 @@ export function findCurrentHostFiberWithNoPortals(parent: Fiber): Fiber | null {
function findCurrentHostFiberWithNoPortalsImpl(node: Fiber) {
// Next we'll drill down this component to find the first HostComponent/Text.
if (node.tag === HostComponent || node.tag === HostText) {
if (
enableFloat &&
supportsHydration &&
isHydratableResource(node.type, node.memoizedProps)
) {
// This is a crude opt out of Resources from this search algorithm
} else {
return node;
}
return node;
}

let child = node.child;
Expand Down

0 comments on commit df91473

Please sign in to comment.