Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable strict effects for legacy roots (again) #21591

Merged
merged 1 commit into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/react-reconciler/src/ReactFiber.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,11 @@ export function createFiberFromTypeAndProps(
break;
case REACT_STRICT_MODE_TYPE:
fiberTag = Mode;
mode |= StrictLegacyMode | StrictEffectsMode;
mode |= StrictLegacyMode;
if (enableStrictEffects && (mode & ConcurrentMode) !== NoMode) {
// Strict effects should never run on legacy roots
mode |= StrictEffectsMode;
}
break;
case REACT_PROFILER_TYPE:
return createFiberFromProfiler(pendingProps, mode, lanes, key);
Expand Down
6 changes: 5 additions & 1 deletion packages/react-reconciler/src/ReactFiber.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,11 @@ export function createFiberFromTypeAndProps(
break;
case REACT_STRICT_MODE_TYPE:
fiberTag = Mode;
mode |= StrictLegacyMode | StrictEffectsMode;
mode |= StrictLegacyMode;
if (enableStrictEffects && (mode & ConcurrentMode) !== NoMode) {
// Strict effects should never run on legacy roots
mode |= StrictEffectsMode;
}
break;
case REACT_PROFILER_TYPE:
return createFiberFromProfiler(pendingProps, mode, lanes, key);
Expand Down
4 changes: 0 additions & 4 deletions packages/react-reconciler/src/ReactFiberClassComponent.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,6 @@ function mountClassInstance(
enableStrictEffects &&
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
fiberFlags |= MountLayoutDev;
}
workInProgress.flags |= fiberFlags;
Expand Down Expand Up @@ -1005,7 +1004,6 @@ function resumeMountClassInstance(
enableStrictEffects &&
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
fiberFlags |= MountLayoutDev;
}
workInProgress.flags |= fiberFlags;
Expand Down Expand Up @@ -1060,7 +1058,6 @@ function resumeMountClassInstance(
enableStrictEffects &&
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
fiberFlags |= MountLayoutDev;
}
workInProgress.flags |= fiberFlags;
Expand All @@ -1078,7 +1075,6 @@ function resumeMountClassInstance(
enableStrictEffects &&
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
fiberFlags |= MountLayoutDev;
}
workInProgress.flags |= fiberFlags;
Expand Down
4 changes: 0 additions & 4 deletions packages/react-reconciler/src/ReactFiberClassComponent.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,6 @@ function mountClassInstance(
enableStrictEffects &&
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
fiberFlags |= MountLayoutDev;
}
workInProgress.flags |= fiberFlags;
Expand Down Expand Up @@ -1005,7 +1004,6 @@ function resumeMountClassInstance(
enableStrictEffects &&
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
fiberFlags |= MountLayoutDev;
}
workInProgress.flags |= fiberFlags;
Expand Down Expand Up @@ -1060,7 +1058,6 @@ function resumeMountClassInstance(
enableStrictEffects &&
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
fiberFlags |= MountLayoutDev;
}
workInProgress.flags |= fiberFlags;
Expand All @@ -1078,7 +1075,6 @@ function resumeMountClassInstance(
enableStrictEffects &&
(workInProgress.mode & StrictEffectsMode) !== NoMode
) {
// Never double-invoke effects for legacy roots.
fiberFlags |= MountLayoutDev;
}
workInProgress.flags |= fiberFlags;
Expand Down