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.
Jan Kassens committed
Aug 5, 2024 at 11:25 UTC
65903583d2ab45aea45bdd23ed0b5dc214ff3c1c
12 files changed
+1
-33
packages/react-dom/src/__tests__/ReactDOMFizzDeferredValue-test.js
-3
@@ -83,7 +83,6 @@ describe('ReactDOMFizzForm', () => {
83
return text;
84
}
85
86
- // @gate enableUseDeferredValueInitialArg
86
it('returns initialValue argument, if provided', async () => {
87
function App() {
88
return useDeferredValue('Final', 'Initial');
@@ -100,7 +99,6 @@ describe('ReactDOMFizzForm', () => {
99
expect(container.textContent).toEqual('Final');
100
});
101
103
- // @gate enableUseDeferredValueInitialArg
102
// @gate enablePostpone
103
it(
104
'if initial value postpones during hydration, it will switch to the ' +
@@ -136,7 +134,6 @@ describe('ReactDOMFizzForm', () => {
134
},
135
);
136
139
- // @gate enableUseDeferredValueInitialArg
137
it(
138
'useDeferredValue during hydration has higher priority than remaining ' +
139
'incremental hydration',
packages/react-reconciler/src/ReactFiberHooks.js
-2
@@ -45,7 +45,6 @@ import {
45
enableLegacyCache,
46
debugRenderPhaseSideEffectsForStrictMode,
47
enableAsyncActions,
48
- enableUseDeferredValueInitialArg,
48
disableLegacyMode,
49
enableNoCloningMemoCache,
50
enableContextProfiling,
@@ -2879,7 +2878,6 @@ function rerenderDeferredValue<T>(value: T, initialValue?: T): T {
2878
2879
function mountDeferredValueImpl<T>(hook: Hook, value: T, initialValue?: T): T {
2880
if (
2882
- enableUseDeferredValueInitialArg &&
2881
// When `initialValue` is provided, we defer the initial render even if the
2882
// current render is not synchronous.
2883
initialValue !== undefined &&
packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js
-12
@@ -371,7 +371,6 @@ describe('ReactDeferredValue', () => {
371
});
372
});
373
374
- // @gate enableUseDeferredValueInitialArg
374
it('supports initialValue argument', async () => {
375
function App() {
376
const value = useDeferredValue('Final', 'Initial');
@@ -388,7 +387,6 @@ describe('ReactDeferredValue', () => {
387
expect(root).toMatchRenderedOutput('Final');
388
});
389
391
- // @gate enableUseDeferredValueInitialArg
390
it('defers during initial render when initialValue is provided, even if render is not sync', async () => {
391
function App() {
392
const value = useDeferredValue('Final', 'Initial');
@@ -406,7 +404,6 @@ describe('ReactDeferredValue', () => {
404
expect(root).toMatchRenderedOutput('Final');
405
});
406
409
- // @gate enableUseDeferredValueInitialArg
407
it(
408
'if a suspended render spawns a deferred task, we can switch to the ' +
409
'deferred task without finishing the original one (no Suspense boundary)',
@@ -439,7 +436,6 @@ describe('ReactDeferredValue', () => {
436
},
437
);
438
442
- // @gate enableUseDeferredValueInitialArg
439
it(
440
'if a suspended render spawns a deferred task, we can switch to the ' +
441
'deferred task without finishing the original one (no Suspense boundary, ' +
@@ -479,7 +475,6 @@ describe('ReactDeferredValue', () => {
475
},
476
);
477
482
- // @gate enableUseDeferredValueInitialArg
478
it(
479
'if a suspended render spawns a deferred task, we can switch to the ' +
480
'deferred task without finishing the original one (Suspense boundary)',
@@ -520,7 +515,6 @@ describe('ReactDeferredValue', () => {
515
},
516
);
517
523
- // @gate enableUseDeferredValueInitialArg
518
it(
519
'if a suspended render spawns a deferred task that also suspends, we can ' +
520
'finish the original task if that one loads first',
@@ -556,7 +550,6 @@ describe('ReactDeferredValue', () => {
550
},
551
);
552
559
- // @gate enableUseDeferredValueInitialArg
553
it(
554
'if there are multiple useDeferredValues in the same tree, only the ' +
555
'first level defers; subsequent ones go straight to the final value, to ' +
@@ -604,7 +597,6 @@ describe('ReactDeferredValue', () => {
597
},
598
);
599
607
- // @gate enableUseDeferredValueInitialArg
600
it('avoids a useDeferredValue waterfall when separated by a Suspense boundary', async () => {
601
// Same as the previous test but with a Suspense boundary separating the
602
// two useDeferredValue hooks.
@@ -649,7 +641,6 @@ describe('ReactDeferredValue', () => {
641
expect(root).toMatchRenderedOutput('Content');
642
});
643
652
- // @gate enableUseDeferredValueInitialArg
644
// @gate enableActivity
645
it('useDeferredValue can spawn a deferred task while prerendering a hidden tree', async () => {
646
function App() {
@@ -696,7 +687,6 @@ describe('ReactDeferredValue', () => {
687
expect(root).toMatchRenderedOutput(<div>Final</div>);
688
});
689
699
- // @gate enableUseDeferredValueInitialArg
690
// @gate enableActivity
691
it('useDeferredValue can prerender the initial value inside a hidden tree', async () => {
692
function App({text}) {
@@ -755,7 +745,6 @@ describe('ReactDeferredValue', () => {
745
expect(root).toMatchRenderedOutput(<div>B</div>);
746
});
747
758
- // @gate enableUseDeferredValueInitialArg
748
// @gate enableActivity
749
it(
750
'useDeferredValue skips the preview state when revealing a hidden tree ' +
@@ -796,7 +785,6 @@ describe('ReactDeferredValue', () => {
785
},
786
);
787
799
- // @gate enableUseDeferredValueInitialArg
788
// @gate enableActivity
789
it(
790
'useDeferredValue does not skip the preview state when revealing a ' +
packages/react-server/src/ReactFizzHooks.js
+1
-6
@@ -43,7 +43,6 @@ import {
43
enableUseEffectEventHook,
44
enableUseMemoCacheHook,
45
enableAsyncActions,
46
- enableUseDeferredValueInitialArg,
46
} from 'shared/ReactFeatureFlags';
47
import is from 'shared/objectIs';
48
import {
@@ -570,11 +569,7 @@ function useSyncExternalStore<T>(
569
570
function useDeferredValue<T>(value: T, initialValue?: T): T {
571
resolveCurrentlyRenderingComponent();
573
- if (enableUseDeferredValueInitialArg) {
574
- return initialValue !== undefined ? initialValue : value;
575
- } else {
576
- return value;
577
- }
572
+ return initialValue !== undefined ? initialValue : value;
573
}
574
575
function unsupportedStartTransition() {
packages/shared/ReactFeatureFlags.js
-3
@@ -221,9 +221,6 @@ export const disableLegacyMode = true;
221
// Make <Context> equivalent to <Context.Provider> instead of <Context.Consumer>
222
export const enableRenderableContext = true;
223
224
-// Enables the `initialValue` option for `useDeferredValue`
225
-export const enableUseDeferredValueInitialArg = true;
226
-
224
// -----------------------------------------------------------------------------
225
// Chopping Block
226
//
packages/shared/forks/ReactFeatureFlags.native-fb.js
-1
@@ -83,7 +83,6 @@ export const enableTaint = true;
83
export const enableTransitionTracing = false;
84
export const enableTrustedTypesIntegration = false;
85
export const enableUpdaterTracking = __PROFILE__;
86
-export const enableUseDeferredValueInitialArg = true;
86
export const enableUseEffectEventHook = false;
87
export const enableUseMemoCacheHook = true;
88
export const favorSafetyOverHydrationPerf = true;
packages/shared/forks/ReactFeatureFlags.native-oss.js
-1
@@ -74,7 +74,6 @@ export const enableSuspenseCallback = false;
74
export const enableTaint = true;
75
export const enableTransitionTracing = false;
76
export const enableTrustedTypesIntegration = false;
77
-export const enableUseDeferredValueInitialArg = true;
77
export const enableUseEffectEventHook = false;
78
export const enableUseMemoCacheHook = true;
79
export const favorSafetyOverHydrationPerf = true;
packages/shared/forks/ReactFeatureFlags.test-renderer.js
-1
@@ -71,7 +71,6 @@ export const alwaysThrottleRetries = true;
71
72
export const passChildrenWhenCloningPersistedNodes = false;
73
export const enablePersistedModeClonedFlag = false;
74
-export const enableUseDeferredValueInitialArg = __EXPERIMENTAL__;
74
export const disableClientCache = true;
75
76
export const enableServerComponentLogs = true;
packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js
-1
@@ -69,7 +69,6 @@ export const enableTaint = true;
69
export const enableTransitionTracing = false;
70
export const enableTrustedTypesIntegration = false;
71
export const enableUpdaterTracking = false;
72
-export const enableUseDeferredValueInitialArg = true;
72
export const enableUseEffectEventHook = false;
73
export const enableUseMemoCacheHook = true;
74
export const favorSafetyOverHydrationPerf = true;
packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
-1
@@ -74,7 +74,6 @@ export const alwaysThrottleRetries = true;
74
75
export const passChildrenWhenCloningPersistedNodes = false;
76
export const enablePersistedModeClonedFlag = false;
77
-export const enableUseDeferredValueInitialArg = true;
77
export const disableClientCache = true;
78
79
export const enableServerComponentLogs = true;
packages/shared/forks/ReactFeatureFlags.www-dynamic.js
-1
@@ -26,7 +26,6 @@ export const enableObjectFiber = __VARIANT__;
26
export const enableRenderableContext = __VARIANT__;
27
export const enableRetryLaneExpiration = __VARIANT__;
28
export const enableTransitionTracing = __VARIANT__;
29
-export const enableUseDeferredValueInitialArg = __VARIANT__;
29
export const favorSafetyOverHydrationPerf = __VARIANT__;
30
export const renameElementSymbol = __VARIANT__;
31
export const retryLaneExpirationMs = 5000;
packages/shared/forks/ReactFeatureFlags.www.js
-1
@@ -30,7 +30,6 @@ export const {
30
enableRetryLaneExpiration,
31
enableTransitionTracing,
32
enableTrustedTypesIntegration,
33
- enableUseDeferredValueInitialArg,
33
favorSafetyOverHydrationPerf,
34
renameElementSymbol,
35
retryLaneExpirationMs,