Skip to content

Commit

Permalink
Renamed strict mode constants
Browse files Browse the repository at this point in the history
StrictModeL1 -> StrictLegacyMode and StrictModeL2 -> StrictEffectsMode
  • Loading branch information
Brian Vaughn committed Feb 22, 2021
1 parent cf9c4ab commit 11b8797
Show file tree
Hide file tree
Showing 22 changed files with 117 additions and 115 deletions.
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactChildFiber.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
} from './ReactFiber.new';
import {emptyRefsObject} from './ReactFiberClassComponent.new';
import {isCompatibleFamilyForHotReloading} from './ReactFiberHotReloading.new';
import {StrictModeL1} from './ReactTypeOfMode';
import {StrictLegacyMode} from './ReactTypeOfMode';

let didWarnAboutMaps;
let didWarnAboutGenerators;
Expand Down Expand Up @@ -114,7 +114,7 @@ function coerceRef(
// TODO: Clean this up once we turn on the string ref warning for
// everyone, because the strict mode case will no longer be relevant
if (
(returnFiber.mode & StrictModeL1 || warnAboutStringRefs) &&
(returnFiber.mode & StrictLegacyMode || warnAboutStringRefs) &&
// We warn in ReactElement.js if owner and self are equal for string refs
// because these cannot be automatically converted to an arrow function
// using a codemod. Therefore, we don't have to warn about string refs again.
Expand Down
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactChildFiber.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
} from './ReactFiber.old';
import {emptyRefsObject} from './ReactFiberClassComponent.old';
import {isCompatibleFamilyForHotReloading} from './ReactFiberHotReloading.old';
import {StrictModeL1} from './ReactTypeOfMode';
import {StrictLegacyMode} from './ReactTypeOfMode';

let didWarnAboutMaps;
let didWarnAboutGenerators;
Expand Down Expand Up @@ -114,7 +114,7 @@ function coerceRef(
// TODO: Clean this up once we turn on the string ref warning for
// everyone, because the strict mode case will no longer be relevant
if (
(returnFiber.mode & StrictModeL1 || warnAboutStringRefs) &&
(returnFiber.mode & StrictLegacyMode || warnAboutStringRefs) &&
// We warn in ReactElement.js if owner and self are equal for string refs
// because these cannot be automatically converted to an arrow function
// using a codemod. Therefore, we don't have to warn about string refs again.
Expand Down
17 changes: 9 additions & 8 deletions packages/react-reconciler/src/ReactFiber.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ import {
ConcurrentMode,
DebugTracingMode,
ProfileMode,
StrictModeL1,
StrictModeL2,
StrictLegacyMode,
StrictEffectsMode,
BlockingMode,
} from './ReactTypeOfMode';
import {
Expand Down Expand Up @@ -424,15 +424,16 @@ export function createHostRootFiber(tag: RootTag): Fiber {
let mode;
if (tag === ConcurrentRoot) {
if (enableDoubleInvokingEffects) {
mode = ConcurrentMode | BlockingMode | StrictModeL1 | StrictModeL2;
mode =
ConcurrentMode | BlockingMode | StrictLegacyMode | StrictEffectsMode;
} else {
mode = ConcurrentMode | BlockingMode | StrictModeL1;
mode = ConcurrentMode | BlockingMode | StrictLegacyMode;
}
} else if (tag === BlockingRoot) {
if (enableDoubleInvokingEffects) {
mode = BlockingMode | StrictModeL1 | StrictModeL2;
mode = BlockingMode | StrictLegacyMode | StrictEffectsMode;
} else {
mode = BlockingMode | StrictModeL1;
mode = BlockingMode | StrictLegacyMode;
}
} else {
mode = NoMode;
Expand Down Expand Up @@ -482,8 +483,8 @@ export function createFiberFromTypeAndProps(
break;
case REACT_STRICT_MODE_TYPE:
fiberTag = Mode;
// TODO (StrictModeL2) Add support for new strict mode "level" attribute
mode |= StrictModeL1;
// TODO (StrictEffectsMode) Add support for new strict mode "level" attribute
mode |= StrictLegacyMode;
break;
case REACT_PROFILER_TYPE:
return createFiberFromProfiler(pendingProps, mode, lanes, key);
Expand Down
17 changes: 9 additions & 8 deletions packages/react-reconciler/src/ReactFiber.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ import {
ConcurrentMode,
DebugTracingMode,
ProfileMode,
StrictModeL1,
StrictModeL2,
StrictLegacyMode,
StrictEffectsMode,
BlockingMode,
} from './ReactTypeOfMode';
import {
Expand Down Expand Up @@ -424,15 +424,16 @@ export function createHostRootFiber(tag: RootTag): Fiber {
let mode;
if (tag === ConcurrentRoot) {
if (enableDoubleInvokingEffects) {
mode = ConcurrentMode | BlockingMode | StrictModeL1 | StrictModeL2;
mode =
ConcurrentMode | BlockingMode | StrictLegacyMode | StrictEffectsMode;
} else {
mode = ConcurrentMode | BlockingMode | StrictModeL1;
mode = ConcurrentMode | BlockingMode | StrictLegacyMode;
}
} else if (tag === BlockingRoot) {
if (enableDoubleInvokingEffects) {
mode = BlockingMode | StrictModeL1 | StrictModeL2;
mode = BlockingMode | StrictLegacyMode | StrictEffectsMode;
} else {
mode = BlockingMode | StrictModeL1;
mode = BlockingMode | StrictLegacyMode;
}
} else {
mode = NoMode;
Expand Down Expand Up @@ -482,8 +483,8 @@ export function createFiberFromTypeAndProps(
break;
case REACT_STRICT_MODE_TYPE:
fiberTag = Mode;
// TODO (StrictModeL2) Add support for new strict mode "level" attribute
mode |= StrictModeL1;
// TODO (StrictEffectsMode) Add support for new strict mode "level" attribute
mode |= StrictLegacyMode;
break;
case REACT_PROFILER_TYPE:
return createFiberFromProfiler(pendingProps, mode, lanes, key);
Expand Down
12 changes: 6 additions & 6 deletions packages/react-reconciler/src/ReactFiberBeginWork.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ import {
ConcurrentMode,
NoMode,
ProfileMode,
StrictModeL1,
StrictLegacyMode,
BlockingMode,
} from './ReactTypeOfMode';
import {
Expand Down Expand Up @@ -357,7 +357,7 @@ function updateForwardRef(
);
if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down Expand Up @@ -889,7 +889,7 @@ function updateFunctionComponent(
);
if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down Expand Up @@ -1068,7 +1068,7 @@ function finishClassComponent(
nextChildren = instance.render();
if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down Expand Up @@ -1478,7 +1478,7 @@ function mountIndeterminateComponent(
}
}

if (workInProgress.mode & StrictModeL1) {
if (workInProgress.mode & StrictLegacyMode) {
ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
}

Expand Down Expand Up @@ -1615,7 +1615,7 @@ function mountIndeterminateComponent(

if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down
12 changes: 6 additions & 6 deletions packages/react-reconciler/src/ReactFiberBeginWork.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ import {
ConcurrentMode,
NoMode,
ProfileMode,
StrictModeL1,
StrictLegacyMode,
BlockingMode,
} from './ReactTypeOfMode';
import {
Expand Down Expand Up @@ -357,7 +357,7 @@ function updateForwardRef(
);
if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down Expand Up @@ -889,7 +889,7 @@ function updateFunctionComponent(
);
if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down Expand Up @@ -1068,7 +1068,7 @@ function finishClassComponent(
nextChildren = instance.render();
if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down Expand Up @@ -1478,7 +1478,7 @@ function mountIndeterminateComponent(
}
}

if (workInProgress.mode & StrictModeL1) {
if (workInProgress.mode & StrictLegacyMode) {
ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
}

Expand Down Expand Up @@ -1615,7 +1615,7 @@ function mountIndeterminateComponent(

if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down
20 changes: 10 additions & 10 deletions packages/react-reconciler/src/ReactFiberClassComponent.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import {resolveDefaultProps} from './ReactFiberLazyComponent.new';
import {
DebugTracingMode,
NoMode,
StrictModeL1,
StrictModeL2,
StrictLegacyMode,
StrictEffectsMode,
} from './ReactTypeOfMode';

import {
Expand Down Expand Up @@ -164,7 +164,7 @@ export function applyDerivedStateFromProps(
if (__DEV__) {
if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down Expand Up @@ -317,7 +317,7 @@ function checkShouldComponentUpdate(
if (__DEV__) {
if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down Expand Up @@ -654,7 +654,7 @@ function constructClassInstance(
if (__DEV__) {
if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down Expand Up @@ -861,7 +861,7 @@ function mountClassInstance(
}
}

if (workInProgress.mode & StrictModeL1) {
if (workInProgress.mode & StrictLegacyMode) {
ReactStrictModeWarnings.recordLegacyContextWarning(
workInProgress,
instance,
Expand Down Expand Up @@ -909,7 +909,7 @@ function mountClassInstance(
if (
__DEV__ &&
enableDoubleInvokingEffects &&
(workInProgress.mode & StrictModeL2) !== NoMode
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
workInProgress.flags |= MountLayoutDev | Update;
Expand Down Expand Up @@ -988,7 +988,7 @@ function resumeMountClassInstance(
if (
__DEV__ &&
enableDoubleInvokingEffects &&
(workInProgress.mode & StrictModeL2) !== NoMode
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
workInProgress.flags |= MountLayoutDev | Update;
Expand Down Expand Up @@ -1040,7 +1040,7 @@ function resumeMountClassInstance(
if (
__DEV__ &&
enableDoubleInvokingEffects &&
(workInProgress.mode & StrictModeL2) !== NoMode
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
workInProgress.flags |= MountLayoutDev | Update;
Expand All @@ -1055,7 +1055,7 @@ function resumeMountClassInstance(
if (
__DEV__ &&
enableDoubleInvokingEffects &&
(workInProgress.mode & StrictModeL2) !== NoMode
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
workInProgress.flags |= MountLayoutDev | Update;
Expand Down
20 changes: 10 additions & 10 deletions packages/react-reconciler/src/ReactFiberClassComponent.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import {resolveDefaultProps} from './ReactFiberLazyComponent.old';
import {
DebugTracingMode,
NoMode,
StrictModeL1,
StrictModeL2,
StrictLegacyMode,
StrictEffectsMode,
} from './ReactTypeOfMode';

import {
Expand Down Expand Up @@ -164,7 +164,7 @@ export function applyDerivedStateFromProps(
if (__DEV__) {
if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down Expand Up @@ -317,7 +317,7 @@ function checkShouldComponentUpdate(
if (__DEV__) {
if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down Expand Up @@ -654,7 +654,7 @@ function constructClassInstance(
if (__DEV__) {
if (
debugRenderPhaseSideEffectsForStrictMode &&
workInProgress.mode & StrictModeL1
workInProgress.mode & StrictLegacyMode
) {
disableLogs();
try {
Expand Down Expand Up @@ -861,7 +861,7 @@ function mountClassInstance(
}
}

if (workInProgress.mode & StrictModeL1) {
if (workInProgress.mode & StrictLegacyMode) {
ReactStrictModeWarnings.recordLegacyContextWarning(
workInProgress,
instance,
Expand Down Expand Up @@ -909,7 +909,7 @@ function mountClassInstance(
if (
__DEV__ &&
enableDoubleInvokingEffects &&
(workInProgress.mode & StrictModeL2) !== NoMode
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
workInProgress.flags |= MountLayoutDev | Update;
Expand Down Expand Up @@ -988,7 +988,7 @@ function resumeMountClassInstance(
if (
__DEV__ &&
enableDoubleInvokingEffects &&
(workInProgress.mode & StrictModeL2) !== NoMode
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
workInProgress.flags |= MountLayoutDev | Update;
Expand Down Expand Up @@ -1040,7 +1040,7 @@ function resumeMountClassInstance(
if (
__DEV__ &&
enableDoubleInvokingEffects &&
(workInProgress.mode & StrictModeL2) !== NoMode
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
workInProgress.flags |= MountLayoutDev | Update;
Expand All @@ -1055,7 +1055,7 @@ function resumeMountClassInstance(
if (
__DEV__ &&
enableDoubleInvokingEffects &&
(workInProgress.mode & StrictModeL2) !== NoMode
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
workInProgress.flags |= MountLayoutDev | Update;
Expand Down
Loading

0 comments on commit 11b8797

Please sign in to comment.