From 65903583d2ab45aea45bdd23ed0b5dc214ff3c1c Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Mon, 5 Aug 2024 11:25:05 -0400 Subject: [PATCH] Remove flag enableUseDeferredValueInitialArg (#30595) This is enabled everywhere for a while and I don't think we'd be backing this out of 19. Seems like it's good to clean up to me. --- .../src/__tests__/ReactDOMFizzDeferredValue-test.js | 3 --- packages/react-reconciler/src/ReactFiberHooks.js | 2 -- .../src/__tests__/ReactDeferredValue-test.js | 12 ------------ packages/react-server/src/ReactFizzHooks.js | 7 +------ packages/shared/ReactFeatureFlags.js | 3 --- packages/shared/forks/ReactFeatureFlags.native-fb.js | 1 - .../shared/forks/ReactFeatureFlags.native-oss.js | 1 - .../shared/forks/ReactFeatureFlags.test-renderer.js | 1 - .../ReactFeatureFlags.test-renderer.native-fb.js | 1 - .../forks/ReactFeatureFlags.test-renderer.www.js | 1 - .../shared/forks/ReactFeatureFlags.www-dynamic.js | 1 - packages/shared/forks/ReactFeatureFlags.www.js | 1 - 12 files changed, 1 insertion(+), 33 deletions(-) diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzDeferredValue-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzDeferredValue-test.js index 04e60648fb2e6..de83a8f0a528d 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzDeferredValue-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzDeferredValue-test.js @@ -83,7 +83,6 @@ describe('ReactDOMFizzForm', () => { return text; } - // @gate enableUseDeferredValueInitialArg it('returns initialValue argument, if provided', async () => { function App() { return useDeferredValue('Final', 'Initial'); @@ -100,7 +99,6 @@ describe('ReactDOMFizzForm', () => { expect(container.textContent).toEqual('Final'); }); - // @gate enableUseDeferredValueInitialArg // @gate enablePostpone it( 'if initial value postpones during hydration, it will switch to the ' + @@ -136,7 +134,6 @@ describe('ReactDOMFizzForm', () => { }, ); - // @gate enableUseDeferredValueInitialArg it( 'useDeferredValue during hydration has higher priority than remaining ' + 'incremental hydration', diff --git a/packages/react-reconciler/src/ReactFiberHooks.js b/packages/react-reconciler/src/ReactFiberHooks.js index 363646eb7ddb4..3ba251b620713 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.js +++ b/packages/react-reconciler/src/ReactFiberHooks.js @@ -45,7 +45,6 @@ import { enableLegacyCache, debugRenderPhaseSideEffectsForStrictMode, enableAsyncActions, - enableUseDeferredValueInitialArg, disableLegacyMode, enableNoCloningMemoCache, enableContextProfiling, @@ -2879,7 +2878,6 @@ function rerenderDeferredValue(value: T, initialValue?: T): T { function mountDeferredValueImpl(hook: Hook, value: T, initialValue?: T): T { if ( - enableUseDeferredValueInitialArg && // When `initialValue` is provided, we defer the initial render even if the // current render is not synchronous. initialValue !== undefined && diff --git a/packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js b/packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js index b321f4bba0de4..b2c38696cc028 100644 --- a/packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js +++ b/packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js @@ -371,7 +371,6 @@ describe('ReactDeferredValue', () => { }); }); - // @gate enableUseDeferredValueInitialArg it('supports initialValue argument', async () => { function App() { const value = useDeferredValue('Final', 'Initial'); @@ -388,7 +387,6 @@ describe('ReactDeferredValue', () => { expect(root).toMatchRenderedOutput('Final'); }); - // @gate enableUseDeferredValueInitialArg it('defers during initial render when initialValue is provided, even if render is not sync', async () => { function App() { const value = useDeferredValue('Final', 'Initial'); @@ -406,7 +404,6 @@ describe('ReactDeferredValue', () => { expect(root).toMatchRenderedOutput('Final'); }); - // @gate enableUseDeferredValueInitialArg it( 'if a suspended render spawns a deferred task, we can switch to the ' + 'deferred task without finishing the original one (no Suspense boundary)', @@ -439,7 +436,6 @@ describe('ReactDeferredValue', () => { }, ); - // @gate enableUseDeferredValueInitialArg it( 'if a suspended render spawns a deferred task, we can switch to the ' + 'deferred task without finishing the original one (no Suspense boundary, ' + @@ -479,7 +475,6 @@ describe('ReactDeferredValue', () => { }, ); - // @gate enableUseDeferredValueInitialArg it( 'if a suspended render spawns a deferred task, we can switch to the ' + 'deferred task without finishing the original one (Suspense boundary)', @@ -520,7 +515,6 @@ describe('ReactDeferredValue', () => { }, ); - // @gate enableUseDeferredValueInitialArg it( 'if a suspended render spawns a deferred task that also suspends, we can ' + 'finish the original task if that one loads first', @@ -556,7 +550,6 @@ describe('ReactDeferredValue', () => { }, ); - // @gate enableUseDeferredValueInitialArg it( 'if there are multiple useDeferredValues in the same tree, only the ' + 'first level defers; subsequent ones go straight to the final value, to ' + @@ -604,7 +597,6 @@ describe('ReactDeferredValue', () => { }, ); - // @gate enableUseDeferredValueInitialArg it('avoids a useDeferredValue waterfall when separated by a Suspense boundary', async () => { // Same as the previous test but with a Suspense boundary separating the // two useDeferredValue hooks. @@ -649,7 +641,6 @@ describe('ReactDeferredValue', () => { expect(root).toMatchRenderedOutput('Content'); }); - // @gate enableUseDeferredValueInitialArg // @gate enableActivity it('useDeferredValue can spawn a deferred task while prerendering a hidden tree', async () => { function App() { @@ -696,7 +687,6 @@ describe('ReactDeferredValue', () => { expect(root).toMatchRenderedOutput(
Final
); }); - // @gate enableUseDeferredValueInitialArg // @gate enableActivity it('useDeferredValue can prerender the initial value inside a hidden tree', async () => { function App({text}) { @@ -755,7 +745,6 @@ describe('ReactDeferredValue', () => { expect(root).toMatchRenderedOutput(
B
); }); - // @gate enableUseDeferredValueInitialArg // @gate enableActivity it( 'useDeferredValue skips the preview state when revealing a hidden tree ' + @@ -796,7 +785,6 @@ describe('ReactDeferredValue', () => { }, ); - // @gate enableUseDeferredValueInitialArg // @gate enableActivity it( 'useDeferredValue does not skip the preview state when revealing a ' + diff --git a/packages/react-server/src/ReactFizzHooks.js b/packages/react-server/src/ReactFizzHooks.js index f5965c4f69096..1c136c6b23ecd 100644 --- a/packages/react-server/src/ReactFizzHooks.js +++ b/packages/react-server/src/ReactFizzHooks.js @@ -43,7 +43,6 @@ import { enableUseEffectEventHook, enableUseMemoCacheHook, enableAsyncActions, - enableUseDeferredValueInitialArg, } from 'shared/ReactFeatureFlags'; import is from 'shared/objectIs'; import { @@ -570,11 +569,7 @@ function useSyncExternalStore( function useDeferredValue(value: T, initialValue?: T): T { resolveCurrentlyRenderingComponent(); - if (enableUseDeferredValueInitialArg) { - return initialValue !== undefined ? initialValue : value; - } else { - return value; - } + return initialValue !== undefined ? initialValue : value; } function unsupportedStartTransition() { diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index f33391b36e5c6..b0286405a6cca 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -221,9 +221,6 @@ export const disableLegacyMode = true; // Make equivalent to instead of export const enableRenderableContext = true; -// Enables the `initialValue` option for `useDeferredValue` -export const enableUseDeferredValueInitialArg = true; - // ----------------------------------------------------------------------------- // Chopping Block // diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index 110c152b59400..4eda27d16cfcb 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -83,7 +83,6 @@ export const enableTaint = true; export const enableTransitionTracing = false; export const enableTrustedTypesIntegration = false; export const enableUpdaterTracking = __PROFILE__; -export const enableUseDeferredValueInitialArg = true; export const enableUseEffectEventHook = false; export const enableUseMemoCacheHook = true; export const favorSafetyOverHydrationPerf = true; diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index 737ecf01e9669..2a4421f41da0a 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -74,7 +74,6 @@ export const enableSuspenseCallback = false; export const enableTaint = true; export const enableTransitionTracing = false; export const enableTrustedTypesIntegration = false; -export const enableUseDeferredValueInitialArg = true; export const enableUseEffectEventHook = false; export const enableUseMemoCacheHook = true; export const favorSafetyOverHydrationPerf = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index eb6bef3b29754..8778bf6558cb4 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -71,7 +71,6 @@ export const alwaysThrottleRetries = true; export const passChildrenWhenCloningPersistedNodes = false; export const enablePersistedModeClonedFlag = false; -export const enableUseDeferredValueInitialArg = __EXPERIMENTAL__; export const disableClientCache = true; export const enableServerComponentLogs = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js index 0436964f889d2..3a8a0c1d44cec 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js @@ -69,7 +69,6 @@ export const enableTaint = true; export const enableTransitionTracing = false; export const enableTrustedTypesIntegration = false; export const enableUpdaterTracking = false; -export const enableUseDeferredValueInitialArg = true; export const enableUseEffectEventHook = false; export const enableUseMemoCacheHook = true; export const favorSafetyOverHydrationPerf = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index 9ce67044464a8..eb801d7bac4b6 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -74,7 +74,6 @@ export const alwaysThrottleRetries = true; export const passChildrenWhenCloningPersistedNodes = false; export const enablePersistedModeClonedFlag = false; -export const enableUseDeferredValueInitialArg = true; export const disableClientCache = true; export const enableServerComponentLogs = true; diff --git a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js index 15e0cf3b3c56c..e2f2751f0c2c8 100644 --- a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js +++ b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js @@ -26,7 +26,6 @@ export const enableObjectFiber = __VARIANT__; export const enableRenderableContext = __VARIANT__; export const enableRetryLaneExpiration = __VARIANT__; export const enableTransitionTracing = __VARIANT__; -export const enableUseDeferredValueInitialArg = __VARIANT__; export const favorSafetyOverHydrationPerf = __VARIANT__; export const renameElementSymbol = __VARIANT__; export const retryLaneExpirationMs = 5000; diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index 18fc5c8823d38..95cd1e5a6ebe6 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -30,7 +30,6 @@ export const { enableRetryLaneExpiration, enableTransitionTracing, enableTrustedTypesIntegration, - enableUseDeferredValueInitialArg, favorSafetyOverHydrationPerf, renameElementSymbol, retryLaneExpirationMs,