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

[flags] Remove enableModernStrictMode #31838

Merged
merged 1 commit into from
Dec 18, 2024
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
3 changes: 1 addition & 2 deletions packages/react-reconciler/src/ReactFiberWorkLoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
enableSchedulingProfiler,
enableUpdaterTracking,
enableTransitionTracing,
useModernStrictMode,
disableLegacyContext,
alwaysThrottleRetries,
enableInfiniteRenderLoopDetection,
Expand Down Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
49 changes: 20 additions & 29 deletions packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',

// 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',
]);
}
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',
]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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}) {
Expand Down
6 changes: 0 additions & 6 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.test-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export const disableClientCache = true;
export const enableServerComponentLogs = true;

export const enableReactTestRendererWarning = false;
export const useModernStrictMode = true;

export const disableLegacyMode = true;

Expand Down
Loading