Skip to content

Commit

Permalink
Cleanup enableFloat flag (facebook#28613)
Browse files Browse the repository at this point in the history
Cleanup enableFloat flag
  • Loading branch information
kassens authored and AndyPengc12 committed Apr 15, 2024
1 parent 39a3e31 commit 8e700a8
Show file tree
Hide file tree
Showing 31 changed files with 599 additions and 1,047 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {

import {getParentSuspenseInstance} from './ReactFiberConfigDOM';

import {enableScopeAPI, enableFloat} from 'shared/ReactFeatureFlags';
import {enableScopeAPI} from 'shared/ReactFeatureFlags';

const randomKey = Math.random().toString(36).slice(2);
const internalInstanceKey = '__reactFiber$' + randomKey;
Expand Down Expand Up @@ -175,7 +175,7 @@ export function getInstanceFromNode(node: Node): Fiber | null {
tag === HostComponent ||
tag === HostText ||
tag === SuspenseComponent ||
(enableFloat ? tag === HostHoistable : false) ||
tag === HostHoistable ||
tag === HostSingleton ||
tag === HostRoot
) {
Expand All @@ -195,7 +195,7 @@ export function getNodeFromInstance(inst: Fiber): Instance | TextInstance {
const tag = inst.tag;
if (
tag === HostComponent ||
(enableFloat ? tag === HostHoistable : false) ||
tag === HostHoistable ||
tag === HostSingleton ||
tag === HostText
) {
Expand Down
22 changes: 0 additions & 22 deletions packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ import {
enableBigIntSupport,
enableCreateEventHandleAPI,
enableScopeAPI,
enableFloat,
enableTrustedTypesIntegration,
enableFormActions,
enableAsyncActions,
Expand Down Expand Up @@ -2161,25 +2160,16 @@ function preconnectAs(
}

function prefetchDNS(href: string) {
if (!enableFloat) {
return;
}
previousDispatcher.prefetchDNS(href);
preconnectAs('dns-prefetch', href, null);
}

function preconnect(href: string, crossOrigin?: ?CrossOriginEnum) {
if (!enableFloat) {
return;
}
previousDispatcher.preconnect(href, crossOrigin);
preconnectAs('preconnect', href, crossOrigin);
}

function preload(href: string, as: string, options?: ?PreloadImplOptions) {
if (!enableFloat) {
return;
}
previousDispatcher.preload(href, as, options);
const ownerDocument = getGlobalDocument();
if (ownerDocument && href && as) {
Expand Down Expand Up @@ -2258,9 +2248,6 @@ function preload(href: string, as: string, options?: ?PreloadImplOptions) {
}

function preloadModule(href: string, options?: ?PreloadModuleImplOptions) {
if (!enableFloat) {
return;
}
previousDispatcher.preloadModule(href, options);
const ownerDocument = getGlobalDocument();
if (ownerDocument && href) {
Expand Down Expand Up @@ -2322,9 +2309,6 @@ function preinitStyle(
precedence: ?string,
options?: ?PreinitStyleOptions,
) {
if (!enableFloat) {
return;
}
previousDispatcher.preinitStyle(href, precedence, options);

const ownerDocument = getGlobalDocument();
Expand Down Expand Up @@ -2399,9 +2383,6 @@ function preinitStyle(
}

function preinitScript(src: string, options?: ?PreinitScriptOptions) {
if (!enableFloat) {
return;
}
previousDispatcher.preinitScript(src, options);

const ownerDocument = getGlobalDocument();
Expand Down Expand Up @@ -2458,9 +2439,6 @@ function preinitModuleScript(
src: string,
options?: ?PreinitModuleScriptOptions,
) {
if (!enableFloat) {
return;
}
previousDispatcher.preinitModuleScript(src, options);

const ownerDocument = getGlobalDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import {
enableLegacyFBSupport,
enableCreateEventHandleAPI,
enableScopeAPI,
enableFloat,
enableFormActions,
} from 'shared/ReactFeatureFlags';
import {createEventListenerWrapperWithPriority} from './ReactDOMEventListener';
Expand Down Expand Up @@ -647,7 +646,7 @@ export function dispatchEventForPluginEventSystem(
if (
parentTag === HostComponent ||
parentTag === HostText ||
(enableFloat ? parentTag === HostHoistable : false) ||
parentTag === HostHoistable ||
parentTag === HostSingleton
) {
node = ancestorInst = parentNode;
Expand Down Expand Up @@ -705,7 +704,7 @@ export function accumulateSinglePhaseListeners(
// Handle listeners that are on HostComponents (i.e. <div>)
if (
(tag === HostComponent ||
(enableFloat ? tag === HostHoistable : false) ||
tag === HostHoistable ||
tag === HostSingleton) &&
stateNode !== null
) {
Expand Down Expand Up @@ -819,7 +818,7 @@ export function accumulateTwoPhaseListeners(
// Handle listeners that are on HostComponents (i.e. <div>)
if (
(tag === HostComponent ||
(enableFloat ? tag === HostHoistable : false) ||
tag === HostHoistable ||
tag === HostSingleton) &&
stateNode !== null
) {
Expand Down Expand Up @@ -922,7 +921,7 @@ function accumulateEnterLeaveListenersForEvent(
}
if (
(tag === HostComponent ||
(enableFloat ? tag === HostHoistable : false) ||
tag === HostHoistable ||
tag === HostSingleton) &&
stateNode !== null
) {
Expand Down
Loading

0 comments on commit 8e700a8

Please sign in to comment.