diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index 5fafd8de5c903..d045fa08496e1 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -3792,12 +3792,9 @@ function commitDoubleInvokeEffectsInDEV( hasPassiveEffects: boolean, ) { if (__DEV__) { - if (useModernStrictMode) { + if (useModernStrictMode && root.tag !== LegacyRoot) { let doubleInvokeEffects = true; - if (root.tag === LegacyRoot && !(root.current.mode & StrictLegacyMode)) { - doubleInvokeEffects = false; - } if ( root.tag === ConcurrentRoot && !(root.current.mode & (StrictLegacyMode | StrictEffectsMode)) diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 67862a4f14288..3d8a7cf563bc8 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -147,7 +147,7 @@ export const disableJavaScriptURLs = false; // Modern behaviour aligns more with what components // components will encounter in production, especially when used With . // TODO: clean up legacy once tests pass WWW. -export const useModernStrictMode = false; +export const useModernStrictMode = __NEXT_MAJOR__; // Not ready to break experimental yet. // Remove IE and MsApp specific workarounds for innerHTML