Skip to content

Commit

Permalink
Remove flag enableUseDeferredValueInitialArg (#30595)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kassens authored Aug 5, 2024
1 parent c0ee8e9 commit 6590358
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ describe('ReactDOMFizzForm', () => {
return text;
}

// @gate enableUseDeferredValueInitialArg
it('returns initialValue argument, if provided', async () => {
function App() {
return useDeferredValue('Final', 'Initial');
Expand All @@ -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 ' +
Expand Down Expand Up @@ -136,7 +134,6 @@ describe('ReactDOMFizzForm', () => {
},
);

// @gate enableUseDeferredValueInitialArg
it(
'useDeferredValue during hydration has higher priority than remaining ' +
'incremental hydration',
Expand Down
2 changes: 0 additions & 2 deletions packages/react-reconciler/src/ReactFiberHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import {
enableLegacyCache,
debugRenderPhaseSideEffectsForStrictMode,
enableAsyncActions,
enableUseDeferredValueInitialArg,
disableLegacyMode,
enableNoCloningMemoCache,
enableContextProfiling,
Expand Down Expand Up @@ -2879,7 +2878,6 @@ function rerenderDeferredValue<T>(value: T, initialValue?: T): T {

function mountDeferredValueImpl<T>(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 &&
Expand Down
12 changes: 0 additions & 12 deletions packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ describe('ReactDeferredValue', () => {
});
});

// @gate enableUseDeferredValueInitialArg
it('supports initialValue argument', async () => {
function App() {
const value = useDeferredValue('Final', 'Initial');
Expand All @@ -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');
Expand All @@ -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)',
Expand Down Expand Up @@ -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, ' +
Expand Down Expand Up @@ -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)',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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 ' +
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -696,7 +687,6 @@ describe('ReactDeferredValue', () => {
expect(root).toMatchRenderedOutput(<div>Final</div>);
});

// @gate enableUseDeferredValueInitialArg
// @gate enableActivity
it('useDeferredValue can prerender the initial value inside a hidden tree', async () => {
function App({text}) {
Expand Down Expand Up @@ -755,7 +745,6 @@ describe('ReactDeferredValue', () => {
expect(root).toMatchRenderedOutput(<div>B</div>);
});

// @gate enableUseDeferredValueInitialArg
// @gate enableActivity
it(
'useDeferredValue skips the preview state when revealing a hidden tree ' +
Expand Down Expand Up @@ -796,7 +785,6 @@ describe('ReactDeferredValue', () => {
},
);

// @gate enableUseDeferredValueInitialArg
// @gate enableActivity
it(
'useDeferredValue does not skip the preview state when revealing a ' +
Expand Down
7 changes: 1 addition & 6 deletions packages/react-server/src/ReactFizzHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {
enableUseEffectEventHook,
enableUseMemoCacheHook,
enableAsyncActions,
enableUseDeferredValueInitialArg,
} from 'shared/ReactFeatureFlags';
import is from 'shared/objectIs';
import {
Expand Down Expand Up @@ -570,11 +569,7 @@ function useSyncExternalStore<T>(

function useDeferredValue<T>(value: T, initialValue?: T): T {
resolveCurrentlyRenderingComponent();
if (enableUseDeferredValueInitialArg) {
return initialValue !== undefined ? initialValue : value;
} else {
return value;
}
return initialValue !== undefined ? initialValue : value;
}

function unsupportedStartTransition() {
Expand Down
3 changes: 0 additions & 3 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,6 @@ export const disableLegacyMode = true;
// Make <Context> equivalent to <Context.Provider> instead of <Context.Consumer>
export const enableRenderableContext = true;

// Enables the `initialValue` option for `useDeferredValue`
export const enableUseDeferredValueInitialArg = true;

// -----------------------------------------------------------------------------
// Chopping Block
//
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 @@ -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;
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 @@ -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;
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 @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.www-dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
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 @@ -30,7 +30,6 @@ export const {
enableRetryLaneExpiration,
enableTransitionTracing,
enableTrustedTypesIntegration,
enableUseDeferredValueInitialArg,
favorSafetyOverHydrationPerf,
renameElementSymbol,
retryLaneExpirationMs,
Expand Down

0 comments on commit 6590358

Please sign in to comment.