Skip to content

Commit 8e700a8

Browse files
kassensAndyPengc12
authored andcommitted
Cleanup enableFloat flag (facebook#28613)
Cleanup enableFloat flag
1 parent 39a3e31 commit 8e700a8

31 files changed

+599
-1047
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434

3535
import {getParentSuspenseInstance} from './ReactFiberConfigDOM';
3636

37-
import {enableScopeAPI, enableFloat} from 'shared/ReactFeatureFlags';
37+
import {enableScopeAPI} from 'shared/ReactFeatureFlags';
3838

3939
const randomKey = Math.random().toString(36).slice(2);
4040
const internalInstanceKey = '__reactFiber$' + randomKey;
@@ -175,7 +175,7 @@ export function getInstanceFromNode(node: Node): Fiber | null {
175175
tag === HostComponent ||
176176
tag === HostText ||
177177
tag === SuspenseComponent ||
178-
(enableFloat ? tag === HostHoistable : false) ||
178+
tag === HostHoistable ||
179179
tag === HostSingleton ||
180180
tag === HostRoot
181181
) {
@@ -195,7 +195,7 @@ export function getNodeFromInstance(inst: Fiber): Instance | TextInstance {
195195
const tag = inst.tag;
196196
if (
197197
tag === HostComponent ||
198-
(enableFloat ? tag === HostHoistable : false) ||
198+
tag === HostHoistable ||
199199
tag === HostSingleton ||
200200
tag === HostText
201201
) {

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

-22
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ import {
9191
enableBigIntSupport,
9292
enableCreateEventHandleAPI,
9393
enableScopeAPI,
94-
enableFloat,
9594
enableTrustedTypesIntegration,
9695
enableFormActions,
9796
enableAsyncActions,
@@ -2161,25 +2160,16 @@ function preconnectAs(
21612160
}
21622161

21632162
function prefetchDNS(href: string) {
2164-
if (!enableFloat) {
2165-
return;
2166-
}
21672163
previousDispatcher.prefetchDNS(href);
21682164
preconnectAs('dns-prefetch', href, null);
21692165
}
21702166

21712167
function preconnect(href: string, crossOrigin?: ?CrossOriginEnum) {
2172-
if (!enableFloat) {
2173-
return;
2174-
}
21752168
previousDispatcher.preconnect(href, crossOrigin);
21762169
preconnectAs('preconnect', href, crossOrigin);
21772170
}
21782171

21792172
function preload(href: string, as: string, options?: ?PreloadImplOptions) {
2180-
if (!enableFloat) {
2181-
return;
2182-
}
21832173
previousDispatcher.preload(href, as, options);
21842174
const ownerDocument = getGlobalDocument();
21852175
if (ownerDocument && href && as) {
@@ -2258,9 +2248,6 @@ function preload(href: string, as: string, options?: ?PreloadImplOptions) {
22582248
}
22592249

22602250
function preloadModule(href: string, options?: ?PreloadModuleImplOptions) {
2261-
if (!enableFloat) {
2262-
return;
2263-
}
22642251
previousDispatcher.preloadModule(href, options);
22652252
const ownerDocument = getGlobalDocument();
22662253
if (ownerDocument && href) {
@@ -2322,9 +2309,6 @@ function preinitStyle(
23222309
precedence: ?string,
23232310
options?: ?PreinitStyleOptions,
23242311
) {
2325-
if (!enableFloat) {
2326-
return;
2327-
}
23282312
previousDispatcher.preinitStyle(href, precedence, options);
23292313

23302314
const ownerDocument = getGlobalDocument();
@@ -2399,9 +2383,6 @@ function preinitStyle(
23992383
}
24002384

24012385
function preinitScript(src: string, options?: ?PreinitScriptOptions) {
2402-
if (!enableFloat) {
2403-
return;
2404-
}
24052386
previousDispatcher.preinitScript(src, options);
24062387

24072388
const ownerDocument = getGlobalDocument();
@@ -2458,9 +2439,6 @@ function preinitModuleScript(
24582439
src: string,
24592440
options?: ?PreinitModuleScriptOptions,
24602441
) {
2461-
if (!enableFloat) {
2462-
return;
2463-
}
24642442
previousDispatcher.preinitModuleScript(src, options);
24652443

24662444
const ownerDocument = getGlobalDocument();

packages/react-dom-bindings/src/events/DOMPluginEventSystem.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ import {
5252
enableLegacyFBSupport,
5353
enableCreateEventHandleAPI,
5454
enableScopeAPI,
55-
enableFloat,
5655
enableFormActions,
5756
} from 'shared/ReactFeatureFlags';
5857
import {createEventListenerWrapperWithPriority} from './ReactDOMEventListener';
@@ -647,7 +646,7 @@ export function dispatchEventForPluginEventSystem(
647646
if (
648647
parentTag === HostComponent ||
649648
parentTag === HostText ||
650-
(enableFloat ? parentTag === HostHoistable : false) ||
649+
parentTag === HostHoistable ||
651650
parentTag === HostSingleton
652651
) {
653652
node = ancestorInst = parentNode;
@@ -705,7 +704,7 @@ export function accumulateSinglePhaseListeners(
705704
// Handle listeners that are on HostComponents (i.e. <div>)
706705
if (
707706
(tag === HostComponent ||
708-
(enableFloat ? tag === HostHoistable : false) ||
707+
tag === HostHoistable ||
709708
tag === HostSingleton) &&
710709
stateNode !== null
711710
) {
@@ -819,7 +818,7 @@ export function accumulateTwoPhaseListeners(
819818
// Handle listeners that are on HostComponents (i.e. <div>)
820819
if (
821820
(tag === HostComponent ||
822-
(enableFloat ? tag === HostHoistable : false) ||
821+
tag === HostHoistable ||
823822
tag === HostSingleton) &&
824823
stateNode !== null
825824
) {
@@ -922,7 +921,7 @@ function accumulateEnterLeaveListenersForEvent(
922921
}
923922
if (
924923
(tag === HostComponent ||
925-
(enableFloat ? tag === HostHoistable : false) ||
924+
tag === HostHoistable ||
926925
tag === HostSingleton) &&
927926
stateNode !== null
928927
) {

0 commit comments

Comments
 (0)