Skip to content

Commit

Permalink
Disable strict effects for legacy roots (again) (#21591)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed May 31, 2021
1 parent d75105f commit 28625c6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
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

0 comments on commit 28625c6

Please sign in to comment.