Skip to content

Commit dd40e13

Browse files
author
Brian Vaughn
committed
Renamed strict mode constants
StrictModeL1 -> StrictLegacyMode and StrictModeL2 -> StrictEffectsMode
1 parent f0a5fac commit dd40e13

22 files changed

+117
-115
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import {
4646
} from './ReactFiber.new';
4747
import {emptyRefsObject} from './ReactFiberClassComponent.new';
4848
import {isCompatibleFamilyForHotReloading} from './ReactFiberHotReloading.new';
49-
import {StrictModeL1} from './ReactTypeOfMode';
49+
import {StrictLegacyMode} from './ReactTypeOfMode';
5050

5151
let didWarnAboutMaps;
5252
let didWarnAboutGenerators;
@@ -114,7 +114,7 @@ function coerceRef(
114114
// TODO: Clean this up once we turn on the string ref warning for
115115
// everyone, because the strict mode case will no longer be relevant
116116
if (
117-
(returnFiber.mode & StrictModeL1 || warnAboutStringRefs) &&
117+
(returnFiber.mode & StrictLegacyMode || warnAboutStringRefs) &&
118118
// We warn in ReactElement.js if owner and self are equal for string refs
119119
// because these cannot be automatically converted to an arrow function
120120
// using a codemod. Therefore, we don't have to warn about string refs again.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import {
4646
} from './ReactFiber.old';
4747
import {emptyRefsObject} from './ReactFiberClassComponent.old';
4848
import {isCompatibleFamilyForHotReloading} from './ReactFiberHotReloading.old';
49-
import {StrictModeL1} from './ReactTypeOfMode';
49+
import {StrictLegacyMode} from './ReactTypeOfMode';
5050

5151
let didWarnAboutMaps;
5252
let didWarnAboutGenerators;
@@ -114,7 +114,7 @@ function coerceRef(
114114
// TODO: Clean this up once we turn on the string ref warning for
115115
// everyone, because the strict mode case will no longer be relevant
116116
if (
117-
(returnFiber.mode & StrictModeL1 || warnAboutStringRefs) &&
117+
(returnFiber.mode & StrictLegacyMode || warnAboutStringRefs) &&
118118
// We warn in ReactElement.js if owner and self are equal for string refs
119119
// because these cannot be automatically converted to an arrow function
120120
// using a codemod. Therefore, we don't have to warn about string refs again.

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ import {
6565
ConcurrentMode,
6666
DebugTracingMode,
6767
ProfileMode,
68-
StrictModeL1,
69-
StrictModeL2,
68+
StrictLegacyMode,
69+
StrictEffectsMode,
7070
BlockingMode,
7171
} from './ReactTypeOfMode';
7272
import {
@@ -424,15 +424,16 @@ export function createHostRootFiber(tag: RootTag): Fiber {
424424
let mode;
425425
if (tag === ConcurrentRoot) {
426426
if (enableDoubleInvokingEffects) {
427-
mode = ConcurrentMode | BlockingMode | StrictModeL1 | StrictModeL2;
427+
mode =
428+
ConcurrentMode | BlockingMode | StrictLegacyMode | StrictEffectsMode;
428429
} else {
429-
mode = ConcurrentMode | BlockingMode | StrictModeL1;
430+
mode = ConcurrentMode | BlockingMode | StrictLegacyMode;
430431
}
431432
} else if (tag === BlockingRoot) {
432433
if (enableDoubleInvokingEffects) {
433-
mode = BlockingMode | StrictModeL1 | StrictModeL2;
434+
mode = BlockingMode | StrictLegacyMode | StrictEffectsMode;
434435
} else {
435-
mode = BlockingMode | StrictModeL1;
436+
mode = BlockingMode | StrictLegacyMode;
436437
}
437438
} else {
438439
mode = NoMode;
@@ -482,8 +483,8 @@ export function createFiberFromTypeAndProps(
482483
break;
483484
case REACT_STRICT_MODE_TYPE:
484485
fiberTag = Mode;
485-
// TODO (StrictModeL2) Add support for new strict mode "level" attribute
486-
mode |= StrictModeL1;
486+
// TODO (StrictEffectsMode) Add support for new strict mode "level" attribute
487+
mode |= StrictLegacyMode;
487488
break;
488489
case REACT_PROFILER_TYPE:
489490
return createFiberFromProfiler(pendingProps, mode, lanes, key);

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ import {
6565
ConcurrentMode,
6666
DebugTracingMode,
6767
ProfileMode,
68-
StrictModeL1,
69-
StrictModeL2,
68+
StrictLegacyMode,
69+
StrictEffectsMode,
7070
BlockingMode,
7171
} from './ReactTypeOfMode';
7272
import {
@@ -424,15 +424,16 @@ export function createHostRootFiber(tag: RootTag): Fiber {
424424
let mode;
425425
if (tag === ConcurrentRoot) {
426426
if (enableDoubleInvokingEffects) {
427-
mode = ConcurrentMode | BlockingMode | StrictModeL1 | StrictModeL2;
427+
mode =
428+
ConcurrentMode | BlockingMode | StrictLegacyMode | StrictEffectsMode;
428429
} else {
429-
mode = ConcurrentMode | BlockingMode | StrictModeL1;
430+
mode = ConcurrentMode | BlockingMode | StrictLegacyMode;
430431
}
431432
} else if (tag === BlockingRoot) {
432433
if (enableDoubleInvokingEffects) {
433-
mode = BlockingMode | StrictModeL1 | StrictModeL2;
434+
mode = BlockingMode | StrictLegacyMode | StrictEffectsMode;
434435
} else {
435-
mode = BlockingMode | StrictModeL1;
436+
mode = BlockingMode | StrictLegacyMode;
436437
}
437438
} else {
438439
mode = NoMode;
@@ -482,8 +483,8 @@ export function createFiberFromTypeAndProps(
482483
break;
483484
case REACT_STRICT_MODE_TYPE:
484485
fiberTag = Mode;
485-
// TODO (StrictModeL2) Add support for new strict mode "level" attribute
486-
mode |= StrictModeL1;
486+
// TODO (StrictEffectsMode) Add support for new strict mode "level" attribute
487+
mode |= StrictLegacyMode;
487488
break;
488489
case REACT_PROFILER_TYPE:
489490
return createFiberFromProfiler(pendingProps, mode, lanes, key);

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ import {
125125
ConcurrentMode,
126126
NoMode,
127127
ProfileMode,
128-
StrictModeL1,
128+
StrictLegacyMode,
129129
BlockingMode,
130130
} from './ReactTypeOfMode';
131131
import {
@@ -357,7 +357,7 @@ function updateForwardRef(
357357
);
358358
if (
359359
debugRenderPhaseSideEffectsForStrictMode &&
360-
workInProgress.mode & StrictModeL1
360+
workInProgress.mode & StrictLegacyMode
361361
) {
362362
disableLogs();
363363
try {
@@ -889,7 +889,7 @@ function updateFunctionComponent(
889889
);
890890
if (
891891
debugRenderPhaseSideEffectsForStrictMode &&
892-
workInProgress.mode & StrictModeL1
892+
workInProgress.mode & StrictLegacyMode
893893
) {
894894
disableLogs();
895895
try {
@@ -1068,7 +1068,7 @@ function finishClassComponent(
10681068
nextChildren = instance.render();
10691069
if (
10701070
debugRenderPhaseSideEffectsForStrictMode &&
1071-
workInProgress.mode & StrictModeL1
1071+
workInProgress.mode & StrictLegacyMode
10721072
) {
10731073
disableLogs();
10741074
try {
@@ -1478,7 +1478,7 @@ function mountIndeterminateComponent(
14781478
}
14791479
}
14801480

1481-
if (workInProgress.mode & StrictModeL1) {
1481+
if (workInProgress.mode & StrictLegacyMode) {
14821482
ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
14831483
}
14841484

@@ -1615,7 +1615,7 @@ function mountIndeterminateComponent(
16151615

16161616
if (
16171617
debugRenderPhaseSideEffectsForStrictMode &&
1618-
workInProgress.mode & StrictModeL1
1618+
workInProgress.mode & StrictLegacyMode
16191619
) {
16201620
disableLogs();
16211621
try {

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ import {
125125
ConcurrentMode,
126126
NoMode,
127127
ProfileMode,
128-
StrictModeL1,
128+
StrictLegacyMode,
129129
BlockingMode,
130130
} from './ReactTypeOfMode';
131131
import {
@@ -357,7 +357,7 @@ function updateForwardRef(
357357
);
358358
if (
359359
debugRenderPhaseSideEffectsForStrictMode &&
360-
workInProgress.mode & StrictModeL1
360+
workInProgress.mode & StrictLegacyMode
361361
) {
362362
disableLogs();
363363
try {
@@ -889,7 +889,7 @@ function updateFunctionComponent(
889889
);
890890
if (
891891
debugRenderPhaseSideEffectsForStrictMode &&
892-
workInProgress.mode & StrictModeL1
892+
workInProgress.mode & StrictLegacyMode
893893
) {
894894
disableLogs();
895895
try {
@@ -1068,7 +1068,7 @@ function finishClassComponent(
10681068
nextChildren = instance.render();
10691069
if (
10701070
debugRenderPhaseSideEffectsForStrictMode &&
1071-
workInProgress.mode & StrictModeL1
1071+
workInProgress.mode & StrictLegacyMode
10721072
) {
10731073
disableLogs();
10741074
try {
@@ -1478,7 +1478,7 @@ function mountIndeterminateComponent(
14781478
}
14791479
}
14801480

1481-
if (workInProgress.mode & StrictModeL1) {
1481+
if (workInProgress.mode & StrictLegacyMode) {
14821482
ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
14831483
}
14841484

@@ -1615,7 +1615,7 @@ function mountIndeterminateComponent(
16151615

16161616
if (
16171617
debugRenderPhaseSideEffectsForStrictMode &&
1618-
workInProgress.mode & StrictModeL1
1618+
workInProgress.mode & StrictLegacyMode
16191619
) {
16201620
disableLogs();
16211621
try {

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import {resolveDefaultProps} from './ReactFiberLazyComponent.new';
3333
import {
3434
DebugTracingMode,
3535
NoMode,
36-
StrictModeL1,
37-
StrictModeL2,
36+
StrictLegacyMode,
37+
StrictEffectsMode,
3838
} from './ReactTypeOfMode';
3939

4040
import {
@@ -164,7 +164,7 @@ export function applyDerivedStateFromProps(
164164
if (__DEV__) {
165165
if (
166166
debugRenderPhaseSideEffectsForStrictMode &&
167-
workInProgress.mode & StrictModeL1
167+
workInProgress.mode & StrictLegacyMode
168168
) {
169169
disableLogs();
170170
try {
@@ -317,7 +317,7 @@ function checkShouldComponentUpdate(
317317
if (__DEV__) {
318318
if (
319319
debugRenderPhaseSideEffectsForStrictMode &&
320-
workInProgress.mode & StrictModeL1
320+
workInProgress.mode & StrictLegacyMode
321321
) {
322322
disableLogs();
323323
try {
@@ -654,7 +654,7 @@ function constructClassInstance(
654654
if (__DEV__) {
655655
if (
656656
debugRenderPhaseSideEffectsForStrictMode &&
657-
workInProgress.mode & StrictModeL1
657+
workInProgress.mode & StrictLegacyMode
658658
) {
659659
disableLogs();
660660
try {
@@ -861,7 +861,7 @@ function mountClassInstance(
861861
}
862862
}
863863

864-
if (workInProgress.mode & StrictModeL1) {
864+
if (workInProgress.mode & StrictLegacyMode) {
865865
ReactStrictModeWarnings.recordLegacyContextWarning(
866866
workInProgress,
867867
instance,
@@ -909,7 +909,7 @@ function mountClassInstance(
909909
if (
910910
__DEV__ &&
911911
enableDoubleInvokingEffects &&
912-
(workInProgress.mode & StrictModeL2) !== NoMode
912+
(workInProgress.mode & StrictEffectsMode) !== NoMode
913913
) {
914914
// Never double-invoke effects for legacy roots.
915915
workInProgress.flags |= MountLayoutDev | Update;
@@ -988,7 +988,7 @@ function resumeMountClassInstance(
988988
if (
989989
__DEV__ &&
990990
enableDoubleInvokingEffects &&
991-
(workInProgress.mode & StrictModeL2) !== NoMode
991+
(workInProgress.mode & StrictEffectsMode) !== NoMode
992992
) {
993993
// Never double-invoke effects for legacy roots.
994994
workInProgress.flags |= MountLayoutDev | Update;
@@ -1040,7 +1040,7 @@ function resumeMountClassInstance(
10401040
if (
10411041
__DEV__ &&
10421042
enableDoubleInvokingEffects &&
1043-
(workInProgress.mode & StrictModeL2) !== NoMode
1043+
(workInProgress.mode & StrictEffectsMode) !== NoMode
10441044
) {
10451045
// Never double-invoke effects for legacy roots.
10461046
workInProgress.flags |= MountLayoutDev | Update;
@@ -1055,7 +1055,7 @@ function resumeMountClassInstance(
10551055
if (
10561056
__DEV__ &&
10571057
enableDoubleInvokingEffects &&
1058-
(workInProgress.mode & StrictModeL2) !== NoMode
1058+
(workInProgress.mode & StrictEffectsMode) !== NoMode
10591059
) {
10601060
// Never double-invoke effects for legacy roots.
10611061
workInProgress.flags |= MountLayoutDev | Update;

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import {resolveDefaultProps} from './ReactFiberLazyComponent.old';
3333
import {
3434
DebugTracingMode,
3535
NoMode,
36-
StrictModeL1,
37-
StrictModeL2,
36+
StrictLegacyMode,
37+
StrictEffectsMode,
3838
} from './ReactTypeOfMode';
3939

4040
import {
@@ -164,7 +164,7 @@ export function applyDerivedStateFromProps(
164164
if (__DEV__) {
165165
if (
166166
debugRenderPhaseSideEffectsForStrictMode &&
167-
workInProgress.mode & StrictModeL1
167+
workInProgress.mode & StrictLegacyMode
168168
) {
169169
disableLogs();
170170
try {
@@ -317,7 +317,7 @@ function checkShouldComponentUpdate(
317317
if (__DEV__) {
318318
if (
319319
debugRenderPhaseSideEffectsForStrictMode &&
320-
workInProgress.mode & StrictModeL1
320+
workInProgress.mode & StrictLegacyMode
321321
) {
322322
disableLogs();
323323
try {
@@ -654,7 +654,7 @@ function constructClassInstance(
654654
if (__DEV__) {
655655
if (
656656
debugRenderPhaseSideEffectsForStrictMode &&
657-
workInProgress.mode & StrictModeL1
657+
workInProgress.mode & StrictLegacyMode
658658
) {
659659
disableLogs();
660660
try {
@@ -861,7 +861,7 @@ function mountClassInstance(
861861
}
862862
}
863863

864-
if (workInProgress.mode & StrictModeL1) {
864+
if (workInProgress.mode & StrictLegacyMode) {
865865
ReactStrictModeWarnings.recordLegacyContextWarning(
866866
workInProgress,
867867
instance,
@@ -909,7 +909,7 @@ function mountClassInstance(
909909
if (
910910
__DEV__ &&
911911
enableDoubleInvokingEffects &&
912-
(workInProgress.mode & StrictModeL2) !== NoMode
912+
(workInProgress.mode & StrictEffectsMode) !== NoMode
913913
) {
914914
// Never double-invoke effects for legacy roots.
915915
workInProgress.flags |= MountLayoutDev | Update;
@@ -988,7 +988,7 @@ function resumeMountClassInstance(
988988
if (
989989
__DEV__ &&
990990
enableDoubleInvokingEffects &&
991-
(workInProgress.mode & StrictModeL2) !== NoMode
991+
(workInProgress.mode & StrictEffectsMode) !== NoMode
992992
) {
993993
// Never double-invoke effects for legacy roots.
994994
workInProgress.flags |= MountLayoutDev | Update;
@@ -1040,7 +1040,7 @@ function resumeMountClassInstance(
10401040
if (
10411041
__DEV__ &&
10421042
enableDoubleInvokingEffects &&
1043-
(workInProgress.mode & StrictModeL2) !== NoMode
1043+
(workInProgress.mode & StrictEffectsMode) !== NoMode
10441044
) {
10451045
// Never double-invoke effects for legacy roots.
10461046
workInProgress.flags |= MountLayoutDev | Update;
@@ -1055,7 +1055,7 @@ function resumeMountClassInstance(
10551055
if (
10561056
__DEV__ &&
10571057
enableDoubleInvokingEffects &&
1058-
(workInProgress.mode & StrictModeL2) !== NoMode
1058+
(workInProgress.mode & StrictEffectsMode) !== NoMode
10591059
) {
10601060
// Never double-invoke effects for legacy roots.
10611061
workInProgress.flags |= MountLayoutDev | Update;

0 commit comments

Comments
 (0)