mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[flags] Remove enableModernStrictMode (#31838)
This is enabled everywhere.
This commit is contained in:
+1
-2
@@ -32,7 +32,6 @@ import {
|
||||
enableSchedulingProfiler,
|
||||
enableUpdaterTracking,
|
||||
enableTransitionTracing,
|
||||
useModernStrictMode,
|
||||
disableLegacyContext,
|
||||
alwaysThrottleRetries,
|
||||
enableInfiniteRenderLoopDetection,
|
||||
@@ -4205,7 +4204,7 @@ function commitDoubleInvokeEffectsInDEV(
|
||||
hasPassiveEffects: boolean,
|
||||
) {
|
||||
if (__DEV__) {
|
||||
if (useModernStrictMode && (disableLegacyMode || root.tag !== LegacyRoot)) {
|
||||
if (disableLegacyMode || root.tag !== LegacyRoot) {
|
||||
let doubleInvokeEffects = true;
|
||||
|
||||
if (
|
||||
|
||||
@@ -77,7 +77,7 @@ describe('Activity StrictMode', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
// @gate __DEV__ && enableActivity && useModernStrictMode
|
||||
// @gate __DEV__ && enableActivity
|
||||
it('should not trigger strict effects when offscreen is hidden', async () => {
|
||||
await act(() => {
|
||||
ReactNoop.render(
|
||||
|
||||
@@ -945,34 +945,25 @@ describe('StrictEffectsMode', () => {
|
||||
shouldSuspend = false;
|
||||
});
|
||||
|
||||
if (gate(flags => flags.useModernStrictMode)) {
|
||||
expect(log).toEqual([
|
||||
'Child rendered',
|
||||
'Child rendered',
|
||||
// !!! Committed, destroy and create effect.
|
||||
// !!! The other effect is not destroyed and created
|
||||
// !!! because the dep didn't change
|
||||
'Child dep destroy',
|
||||
'Child dep create',
|
||||
expect(log).toEqual([
|
||||
'Child rendered',
|
||||
'Child rendered',
|
||||
// !!! Committed, destroy and create effect.
|
||||
// !!! The other effect is not destroyed and created
|
||||
// !!! because the dep didn't change
|
||||
'Child dep destroy',
|
||||
'Child dep create',
|
||||
|
||||
// Double invoke both effects
|
||||
'Child destroy',
|
||||
'Child dep destroy',
|
||||
'Child create',
|
||||
'Child dep create',
|
||||
// Fires setState
|
||||
'-----------------------after setState',
|
||||
'Child rendered',
|
||||
'Child rendered',
|
||||
'Child dep create',
|
||||
]);
|
||||
} else {
|
||||
expect(log).toEqual([
|
||||
'Child rendered',
|
||||
'Child rendered',
|
||||
'Child dep destroy',
|
||||
'Child dep create',
|
||||
]);
|
||||
}
|
||||
// Double invoke both effects
|
||||
'Child destroy',
|
||||
'Child dep destroy',
|
||||
'Child create',
|
||||
'Child dep create',
|
||||
// Fires setState
|
||||
'-----------------------after setState',
|
||||
'Child rendered',
|
||||
'Child rendered',
|
||||
'Child dep create',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -461,7 +461,6 @@ describe('StrictEffectsMode defaults', () => {
|
||||
expect(log).toEqual([]);
|
||||
});
|
||||
|
||||
//@gate useModernStrictMode
|
||||
it('disconnects refs during double invoking', async () => {
|
||||
const onRefMock = jest.fn();
|
||||
function App({text}) {
|
||||
|
||||
@@ -186,12 +186,6 @@ export const disableLegacyContext = true;
|
||||
*/
|
||||
export const disableLegacyContextForFunctionComponents = true;
|
||||
|
||||
// Not ready to break experimental yet.
|
||||
// Modern <StrictMode /> behaviour aligns more with what components
|
||||
// components will encounter in production, especially when used With <Offscreen />.
|
||||
// TODO: clean up legacy <StrictMode /> once tests pass WWW.
|
||||
export const useModernStrictMode = true;
|
||||
|
||||
// Enable the moveBefore() alternative to insertBefore(). This preserves states of moves.
|
||||
export const enableMoveBefore = false;
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ export const renameElementSymbol = false;
|
||||
export const retryLaneExpirationMs = 5000;
|
||||
export const syncLaneExpirationMs = 250;
|
||||
export const transitionLaneExpirationMs = 5000;
|
||||
export const useModernStrictMode = true;
|
||||
export const enableHydrationLaneScheduling = true;
|
||||
export const enableYieldingBeforePassive = false;
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@ export const renameElementSymbol = true;
|
||||
export const retryLaneExpirationMs = 5000;
|
||||
export const syncLaneExpirationMs = 250;
|
||||
export const transitionLaneExpirationMs = 5000;
|
||||
export const useModernStrictMode = true;
|
||||
export const enableSiblingPrerendering = true;
|
||||
export const enableUseResourceEffectHook = false;
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ export const enableLegacyHidden = false;
|
||||
|
||||
export const enableTransitionTracing = false;
|
||||
|
||||
export const useModernStrictMode = true;
|
||||
export const enableDO_NOT_USE_disableStrictPassiveEffect = false;
|
||||
export const enableFizzExternalRuntime = true;
|
||||
export const enableDeferRootSchedulingToMicrotask = true;
|
||||
|
||||
@@ -65,7 +65,6 @@ export const renameElementSymbol = false;
|
||||
export const retryLaneExpirationMs = 5000;
|
||||
export const syncLaneExpirationMs = 250;
|
||||
export const transitionLaneExpirationMs = 5000;
|
||||
export const useModernStrictMode = true;
|
||||
export const enableFabricCompleteRootInCommitPhase = false;
|
||||
export const enableSiblingPrerendering = true;
|
||||
export const enableUseResourceEffectHook = true;
|
||||
|
||||
@@ -54,7 +54,6 @@ export const enableLegacyHidden = false;
|
||||
|
||||
export const enableTransitionTracing = false;
|
||||
|
||||
export const useModernStrictMode = true;
|
||||
export const enableDO_NOT_USE_disableStrictPassiveEffect = false;
|
||||
export const enableFizzExternalRuntime = false;
|
||||
export const enableDeferRootSchedulingToMicrotask = true;
|
||||
|
||||
@@ -106,7 +106,6 @@ export const disableClientCache = true;
|
||||
export const enableServerComponentLogs = true;
|
||||
|
||||
export const enableReactTestRendererWarning = false;
|
||||
export const useModernStrictMode = true;
|
||||
|
||||
export const disableLegacyMode = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user