Skip to content

Commit ce6a837

Browse files
committed
Remove feature flag enableStrictEffects
1 parent 2d80a0c commit ce6a837

24 files changed

+31
-118
lines changed

packages/react-reconciler/src/ReactFiber.new.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {supportsResources, isHostResourceType} from './ReactFiberHostConfig';
2525
import {
2626
createRootStrictEffectsByDefault,
2727
enableCache,
28-
enableStrictEffects,
2928
enableProfilerTimer,
3029
enableScopeAPI,
3130
enableLegacyHidden,
@@ -442,13 +441,7 @@ export function createHostRootFiber(
442441
let mode;
443442
if (tag === ConcurrentRoot) {
444443
mode = ConcurrentMode;
445-
if (isStrictMode === true) {
446-
mode |= StrictLegacyMode;
447-
448-
if (enableStrictEffects) {
449-
mode |= StrictEffectsMode;
450-
}
451-
} else if (enableStrictEffects && createRootStrictEffectsByDefault) {
444+
if (isStrictMode === true || createRootStrictEffectsByDefault) {
452445
mode |= StrictLegacyMode | StrictEffectsMode;
453446
}
454447
if (
@@ -511,7 +504,7 @@ export function createFiberFromTypeAndProps(
511504
case REACT_STRICT_MODE_TYPE:
512505
fiberTag = Mode;
513506
mode |= StrictLegacyMode;
514-
if (enableStrictEffects && (mode & ConcurrentMode) !== NoMode) {
507+
if ((mode & ConcurrentMode) !== NoMode) {
515508
// Strict effects should never run on legacy roots
516509
mode |= StrictEffectsMode;
517510
}

packages/react-reconciler/src/ReactFiber.old.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {supportsResources, isHostResourceType} from './ReactFiberHostConfig';
2525
import {
2626
createRootStrictEffectsByDefault,
2727
enableCache,
28-
enableStrictEffects,
2928
enableProfilerTimer,
3029
enableScopeAPI,
3130
enableLegacyHidden,
@@ -442,13 +441,7 @@ export function createHostRootFiber(
442441
let mode;
443442
if (tag === ConcurrentRoot) {
444443
mode = ConcurrentMode;
445-
if (isStrictMode === true) {
446-
mode |= StrictLegacyMode;
447-
448-
if (enableStrictEffects) {
449-
mode |= StrictEffectsMode;
450-
}
451-
} else if (enableStrictEffects && createRootStrictEffectsByDefault) {
444+
if (isStrictMode === true || createRootStrictEffectsByDefault) {
452445
mode |= StrictLegacyMode | StrictEffectsMode;
453446
}
454447
if (
@@ -511,7 +504,7 @@ export function createFiberFromTypeAndProps(
511504
case REACT_STRICT_MODE_TYPE:
512505
fiberTag = Mode;
513506
mode |= StrictLegacyMode;
514-
if (enableStrictEffects && (mode & ConcurrentMode) !== NoMode) {
507+
if ((mode & ConcurrentMode) !== NoMode) {
515508
// Strict effects should never run on legacy roots
516509
mode |= StrictEffectsMode;
517510
}

packages/react-reconciler/src/ReactFiberClassComponent.new.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
enableSchedulingProfiler,
2727
warnAboutDeprecatedLifecycles,
2828
enableLazyContextPropagation,
29-
enableStrictEffects,
3029
} from 'shared/ReactFeatureFlags';
3130
import ReactStrictModeWarnings from './ReactStrictModeWarnings.new';
3231
import {isMounted} from './ReactFiberTreeReflection';
@@ -908,11 +907,7 @@ function mountClassInstance(
908907

909908
if (typeof instance.componentDidMount === 'function') {
910909
let fiberFlags: Flags = Update | LayoutStatic;
911-
if (
912-
__DEV__ &&
913-
enableStrictEffects &&
914-
(workInProgress.mode & StrictEffectsMode) !== NoMode
915-
) {
910+
if (__DEV__ && (workInProgress.mode & StrictEffectsMode) !== NoMode) {
916911
fiberFlags |= MountLayoutDev;
917912
}
918913
workInProgress.flags |= fiberFlags;
@@ -986,11 +981,7 @@ function resumeMountClassInstance(
986981
// effect even though we're bailing out, so that cWU/cDU are called.
987982
if (typeof instance.componentDidMount === 'function') {
988983
let fiberFlags: Flags = Update | LayoutStatic;
989-
if (
990-
__DEV__ &&
991-
enableStrictEffects &&
992-
(workInProgress.mode & StrictEffectsMode) !== NoMode
993-
) {
984+
if (__DEV__ && (workInProgress.mode & StrictEffectsMode) !== NoMode) {
994985
fiberFlags |= MountLayoutDev;
995986
}
996987
workInProgress.flags |= fiberFlags;
@@ -1037,11 +1028,7 @@ function resumeMountClassInstance(
10371028
}
10381029
if (typeof instance.componentDidMount === 'function') {
10391030
let fiberFlags: Flags = Update | LayoutStatic;
1040-
if (
1041-
__DEV__ &&
1042-
enableStrictEffects &&
1043-
(workInProgress.mode & StrictEffectsMode) !== NoMode
1044-
) {
1031+
if (__DEV__ && (workInProgress.mode & StrictEffectsMode) !== NoMode) {
10451032
fiberFlags |= MountLayoutDev;
10461033
}
10471034
workInProgress.flags |= fiberFlags;
@@ -1051,11 +1038,7 @@ function resumeMountClassInstance(
10511038
// effect even though we're bailing out, so that cWU/cDU are called.
10521039
if (typeof instance.componentDidMount === 'function') {
10531040
let fiberFlags: Flags = Update | LayoutStatic;
1054-
if (
1055-
__DEV__ &&
1056-
enableStrictEffects &&
1057-
(workInProgress.mode & StrictEffectsMode) !== NoMode
1058-
) {
1041+
if (__DEV__ && (workInProgress.mode & StrictEffectsMode) !== NoMode) {
10591042
fiberFlags |= MountLayoutDev;
10601043
}
10611044
workInProgress.flags |= fiberFlags;

packages/react-reconciler/src/ReactFiberClassComponent.old.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
enableSchedulingProfiler,
2727
warnAboutDeprecatedLifecycles,
2828
enableLazyContextPropagation,
29-
enableStrictEffects,
3029
} from 'shared/ReactFeatureFlags';
3130
import ReactStrictModeWarnings from './ReactStrictModeWarnings.old';
3231
import {isMounted} from './ReactFiberTreeReflection';
@@ -908,11 +907,7 @@ function mountClassInstance(
908907

909908
if (typeof instance.componentDidMount === 'function') {
910909
let fiberFlags: Flags = Update | LayoutStatic;
911-
if (
912-
__DEV__ &&
913-
enableStrictEffects &&
914-
(workInProgress.mode & StrictEffectsMode) !== NoMode
915-
) {
910+
if (__DEV__ && (workInProgress.mode & StrictEffectsMode) !== NoMode) {
916911
fiberFlags |= MountLayoutDev;
917912
}
918913
workInProgress.flags |= fiberFlags;
@@ -986,11 +981,7 @@ function resumeMountClassInstance(
986981
// effect even though we're bailing out, so that cWU/cDU are called.
987982
if (typeof instance.componentDidMount === 'function') {
988983
let fiberFlags: Flags = Update | LayoutStatic;
989-
if (
990-
__DEV__ &&
991-
enableStrictEffects &&
992-
(workInProgress.mode & StrictEffectsMode) !== NoMode
993-
) {
984+
if (__DEV__ && (workInProgress.mode & StrictEffectsMode) !== NoMode) {
994985
fiberFlags |= MountLayoutDev;
995986
}
996987
workInProgress.flags |= fiberFlags;
@@ -1037,11 +1028,7 @@ function resumeMountClassInstance(
10371028
}
10381029
if (typeof instance.componentDidMount === 'function') {
10391030
let fiberFlags: Flags = Update | LayoutStatic;
1040-
if (
1041-
__DEV__ &&
1042-
enableStrictEffects &&
1043-
(workInProgress.mode & StrictEffectsMode) !== NoMode
1044-
) {
1031+
if (__DEV__ && (workInProgress.mode & StrictEffectsMode) !== NoMode) {
10451032
fiberFlags |= MountLayoutDev;
10461033
}
10471034
workInProgress.flags |= fiberFlags;
@@ -1051,11 +1038,7 @@ function resumeMountClassInstance(
10511038
// effect even though we're bailing out, so that cWU/cDU are called.
10521039
if (typeof instance.componentDidMount === 'function') {
10531040
let fiberFlags: Flags = Update | LayoutStatic;
1054-
if (
1055-
__DEV__ &&
1056-
enableStrictEffects &&
1057-
(workInProgress.mode & StrictEffectsMode) !== NoMode
1058-
) {
1041+
if (__DEV__ && (workInProgress.mode & StrictEffectsMode) !== NoMode) {
10591042
fiberFlags |= MountLayoutDev;
10601043
}
10611044
workInProgress.flags |= fiberFlags;

packages/react-reconciler/src/ReactFiberCommitWork.new.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ import {
5050
enableCache,
5151
enableTransitionTracing,
5252
enableUseEventHook,
53-
enableStrictEffects,
5453
enableFloat,
5554
} from 'shared/ReactFeatureFlags';
5655
import {
@@ -4183,7 +4182,7 @@ function commitPassiveUnmountInsideDeletedTreeOnFiber(
41834182
}
41844183

41854184
function invokeLayoutEffectMountInDEV(fiber: Fiber): void {
4186-
if (__DEV__ && enableStrictEffects) {
4185+
if (__DEV__) {
41874186
// We don't need to re-check StrictEffectsMode here.
41884187
// This function is only called if that check has already passed.
41894188
switch (fiber.tag) {
@@ -4211,7 +4210,7 @@ function invokeLayoutEffectMountInDEV(fiber: Fiber): void {
42114210
}
42124211

42134212
function invokePassiveEffectMountInDEV(fiber: Fiber): void {
4214-
if (__DEV__ && enableStrictEffects) {
4213+
if (__DEV__) {
42154214
// We don't need to re-check StrictEffectsMode here.
42164215
// This function is only called if that check has already passed.
42174216
switch (fiber.tag) {
@@ -4230,7 +4229,7 @@ function invokePassiveEffectMountInDEV(fiber: Fiber): void {
42304229
}
42314230

42324231
function invokeLayoutEffectUnmountInDEV(fiber: Fiber): void {
4233-
if (__DEV__ && enableStrictEffects) {
4232+
if (__DEV__) {
42344233
// We don't need to re-check StrictEffectsMode here.
42354234
// This function is only called if that check has already passed.
42364235
switch (fiber.tag) {
@@ -4260,7 +4259,7 @@ function invokeLayoutEffectUnmountInDEV(fiber: Fiber): void {
42604259
}
42614260

42624261
function invokePassiveEffectUnmountInDEV(fiber: Fiber): void {
4263-
if (__DEV__ && enableStrictEffects) {
4262+
if (__DEV__) {
42644263
// We don't need to re-check StrictEffectsMode here.
42654264
// This function is only called if that check has already passed.
42664265
switch (fiber.tag) {

packages/react-reconciler/src/ReactFiberCommitWork.old.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ import {
5050
enableCache,
5151
enableTransitionTracing,
5252
enableUseEventHook,
53-
enableStrictEffects,
5453
enableFloat,
5554
} from 'shared/ReactFeatureFlags';
5655
import {
@@ -4183,7 +4182,7 @@ function commitPassiveUnmountInsideDeletedTreeOnFiber(
41834182
}
41844183

41854184
function invokeLayoutEffectMountInDEV(fiber: Fiber): void {
4186-
if (__DEV__ && enableStrictEffects) {
4185+
if (__DEV__) {
41874186
// We don't need to re-check StrictEffectsMode here.
41884187
// This function is only called if that check has already passed.
41894188
switch (fiber.tag) {
@@ -4211,7 +4210,7 @@ function invokeLayoutEffectMountInDEV(fiber: Fiber): void {
42114210
}
42124211

42134212
function invokePassiveEffectMountInDEV(fiber: Fiber): void {
4214-
if (__DEV__ && enableStrictEffects) {
4213+
if (__DEV__) {
42154214
// We don't need to re-check StrictEffectsMode here.
42164215
// This function is only called if that check has already passed.
42174216
switch (fiber.tag) {
@@ -4230,7 +4229,7 @@ function invokePassiveEffectMountInDEV(fiber: Fiber): void {
42304229
}
42314230

42324231
function invokeLayoutEffectUnmountInDEV(fiber: Fiber): void {
4233-
if (__DEV__ && enableStrictEffects) {
4232+
if (__DEV__) {
42344233
// We don't need to re-check StrictEffectsMode here.
42354234
// This function is only called if that check has already passed.
42364235
switch (fiber.tag) {
@@ -4260,7 +4259,7 @@ function invokeLayoutEffectUnmountInDEV(fiber: Fiber): void {
42604259
}
42614260

42624261
function invokePassiveEffectUnmountInDEV(fiber: Fiber): void {
4263-
if (__DEV__ && enableStrictEffects) {
4262+
if (__DEV__) {
42644263
// We don't need to re-check StrictEffectsMode here.
42654264
// This function is only called if that check has already passed.
42664265
switch (fiber.tag) {

packages/react-reconciler/src/ReactFiberHooks.new.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import {
4242
enableUseHook,
4343
enableUseMemoCacheHook,
4444
enableUseEventHook,
45-
enableStrictEffects,
4645
} from 'shared/ReactFeatureFlags';
4746
import {
4847
REACT_CONTEXT_TYPE,
@@ -600,11 +599,7 @@ export function bailoutHooks(
600599
workInProgress.updateQueue = current.updateQueue;
601600
// TODO: Don't need to reset the flags here, because they're reset in the
602601
// complete phase (bubbleProperties).
603-
if (
604-
__DEV__ &&
605-
enableStrictEffects &&
606-
(workInProgress.mode & StrictEffectsMode) !== NoMode
607-
) {
602+
if (__DEV__ && (workInProgress.mode & StrictEffectsMode) !== NoMode) {
608603
workInProgress.flags &= ~(
609604
MountPassiveDevEffect |
610605
MountLayoutDevEffect |
@@ -1884,7 +1879,6 @@ function mountEffect(
18841879
): void {
18851880
if (
18861881
__DEV__ &&
1887-
enableStrictEffects &&
18881882
(currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode
18891883
) {
18901884
return mountEffectImpl(
@@ -1979,7 +1973,6 @@ function mountLayoutEffect(
19791973
let fiberFlags: Flags = UpdateEffect | LayoutStaticEffect;
19801974
if (
19811975
__DEV__ &&
1982-
enableStrictEffects &&
19831976
(currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode
19841977
) {
19851978
fiberFlags |= MountLayoutDevEffect;
@@ -2046,7 +2039,6 @@ function mountImperativeHandle<T>(
20462039
let fiberFlags: Flags = UpdateEffect | LayoutStaticEffect;
20472040
if (
20482041
__DEV__ &&
2049-
enableStrictEffects &&
20502042
(currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode
20512043
) {
20522044
fiberFlags |= MountLayoutDevEffect;

packages/react-reconciler/src/ReactFiberHooks.old.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import {
4242
enableUseHook,
4343
enableUseMemoCacheHook,
4444
enableUseEventHook,
45-
enableStrictEffects,
4645
} from 'shared/ReactFeatureFlags';
4746
import {
4847
REACT_CONTEXT_TYPE,
@@ -600,11 +599,7 @@ export function bailoutHooks(
600599
workInProgress.updateQueue = current.updateQueue;
601600
// TODO: Don't need to reset the flags here, because they're reset in the
602601
// complete phase (bubbleProperties).
603-
if (
604-
__DEV__ &&
605-
enableStrictEffects &&
606-
(workInProgress.mode & StrictEffectsMode) !== NoMode
607-
) {
602+
if (__DEV__ && (workInProgress.mode & StrictEffectsMode) !== NoMode) {
608603
workInProgress.flags &= ~(
609604
MountPassiveDevEffect |
610605
MountLayoutDevEffect |
@@ -1884,7 +1879,6 @@ function mountEffect(
18841879
): void {
18851880
if (
18861881
__DEV__ &&
1887-
enableStrictEffects &&
18881882
(currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode
18891883
) {
18901884
return mountEffectImpl(
@@ -1979,7 +1973,6 @@ function mountLayoutEffect(
19791973
let fiberFlags: Flags = UpdateEffect | LayoutStaticEffect;
19801974
if (
19811975
__DEV__ &&
1982-
enableStrictEffects &&
19831976
(currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode
19841977
) {
19851978
fiberFlags |= MountLayoutDevEffect;
@@ -2046,7 +2039,6 @@ function mountImperativeHandle<T>(
20462039
let fiberFlags: Flags = UpdateEffect | LayoutStaticEffect;
20472040
if (
20482041
__DEV__ &&
2049-
enableStrictEffects &&
20502042
(currentlyRenderingFiber.mode & StrictEffectsMode) !== NoMode
20512043
) {
20522044
fiberFlags |= MountLayoutDevEffect;

packages/react-reconciler/src/ReactFiberWorkLoop.new.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import {
3535
enableDebugTracing,
3636
enableSchedulingProfiler,
3737
disableSchedulerTimeoutInWorkLoop,
38-
enableStrictEffects,
3938
skipUnmountedBoundaries,
4039
enableUpdaterTracking,
4140
enableCache,
@@ -2580,7 +2579,7 @@ function commitRootImpl(
25802579
legacyErrorBoundariesThatAlreadyFailed = null;
25812580
}
25822581

2583-
if (__DEV__ && enableStrictEffects) {
2582+
if (__DEV__) {
25842583
if (!rootDidHavePassiveEffects) {
25852584
commitDoubleInvokeEffectsInDEV(root, false);
25862585
}
@@ -2857,7 +2856,7 @@ function flushPassiveEffectsImpl() {
28572856
markPassiveEffectsStopped();
28582857
}
28592858

2860-
if (__DEV__ && enableStrictEffects) {
2859+
if (__DEV__) {
28612860
commitDoubleInvokeEffectsInDEV(root, true);
28622861
}
28632862

@@ -3325,7 +3324,7 @@ function commitDoubleInvokeEffectsInDEV(
33253324
root: FiberRoot,
33263325
hasPassiveEffects: boolean,
33273326
) {
3328-
if (__DEV__ && enableStrictEffects) {
3327+
if (__DEV__) {
33293328
if (useModernStrictMode) {
33303329
let doubleInvokeEffects = true;
33313330

0 commit comments

Comments
 (0)