diff --git a/packages/react-client/src/__tests__/ReactFlight-test.js b/packages/react-client/src/__tests__/ReactFlight-test.js index cb240482273d1..23a44a41ed803 100644 --- a/packages/react-client/src/__tests__/ReactFlight-test.js +++ b/packages/react-client/src/__tests__/ReactFlight-test.js @@ -530,7 +530,6 @@ describe('ReactFlight', () => { expect(ReactNoop).toMatchRenderedOutput(
$1
'); }); - // @gate enableUseHook it('should not get confused by @', async () => { // Model function RootModel() { @@ -250,7 +247,6 @@ describe('ReactFlightDOM', () => { expect(container.innerHTML).toBe('@div
'); }); - // @gate enableUseHook it('should be able to esm compat test module references', async () => { const ESMCompatModule = { __esModule: true, @@ -300,7 +296,6 @@ describe('ReactFlightDOM', () => { expect(container.innerHTML).toBe('Hello World
'); }); - // @gate enableUseHook it('should be able to render a named component export', async () => { const Module = { Component: function ({greeting}) { @@ -338,7 +333,6 @@ describe('ReactFlightDOM', () => { expect(container.innerHTML).toBe('Hello World
'); }); - // @gate enableUseHook it('should be able to render a module split named component export', async () => { const Module = { // This gets split into a separate module from the original one. @@ -377,7 +371,6 @@ describe('ReactFlightDOM', () => { expect(container.innerHTML).toBe('Hello World
'); }); - // @gate enableUseHook it('should unwrap async module references', async () => { const AsyncModule = Promise.resolve(function AsyncModule({text}) { return 'Async: ' + text; @@ -418,7 +411,6 @@ describe('ReactFlightDOM', () => { expect(container.innerHTML).toBe('Async: Module
'); }); - // @gate enableUseHook it('should unwrap async module references using use', async () => { const AsyncModule = Promise.resolve('Async Text'); @@ -457,7 +449,6 @@ describe('ReactFlightDOM', () => { expect(container.innerHTML).toBe('Async Text
'); }); - // @gate enableUseHook it('should be able to import a name called "then"', async () => { const thenExports = { then: function then() { @@ -531,7 +522,6 @@ describe('ReactFlightDOM', () => { ); }); - // @gate enableUseHook it('should progressively reveal server components', async () => { let reportedErrors = []; @@ -728,7 +718,6 @@ describe('ReactFlightDOM', () => { expect(reportedErrors).toEqual([]); }); - // @gate enableUseHook it('should preserve state of client components on refetch', async () => { // Client @@ -814,7 +803,6 @@ describe('ReactFlightDOM', () => { expect(inputB.value).toBe('goodbye'); }); - // @gate enableUseHook it('should be able to complete after aborting and throw the reason client-side', async () => { const reportedErrors = []; @@ -873,7 +861,6 @@ describe('ReactFlightDOM', () => { expect(reportedErrors).toEqual(['for reasons']); }); - // @gate enableUseHook it('should be able to recover from a direct reference erroring client-side', async () => { const reportedErrors = []; @@ -919,7 +906,6 @@ describe('ReactFlightDOM', () => { expect(reportedErrors).toEqual([]); }); - // @gate enableUseHook it('should be able to recover from a direct reference erroring client-side async', async () => { const reportedErrors = []; @@ -977,7 +963,6 @@ describe('ReactFlightDOM', () => { expect(reportedErrors).toEqual([]); }); - // @gate enableUseHook it('should be able to recover from a direct reference erroring server-side', async () => { const reportedErrors = []; @@ -1044,7 +1029,6 @@ describe('ReactFlightDOM', () => { expect(reportedErrors).toEqual(['bug in the bundler']); }); - // @gate enableUseHook it('should pass a Promise through props and be able use() it on the client', async () => { async function getData() { return 'async hello'; @@ -1090,7 +1074,6 @@ describe('ReactFlightDOM', () => { expect(container.innerHTML).toBe('async hello
'); }); - // @gate enableUseHook it('should throw on the client if a passed promise eventually rejects', async () => { const reportedErrors = []; const theError = new Error('Server throw'); @@ -1158,7 +1141,6 @@ describe('ReactFlightDOM', () => { expect(reportedErrors).toEqual([theError]); }); - // @gate enableUseHook it('should support ReactDOM.preload when rendering in Fiber', async () => { function Component() { returnhello world
; @@ -1214,7 +1196,6 @@ describe('ReactFlightDOM', () => { expect(container.innerHTML).toBe('hello world
'); }); - // @gate enableUseHook it('should support ReactDOM.preload when rendering in Fizz', async () => { function Component() { returnhello world
; diff --git a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js index c846493de8430..b1e41f2a232f7 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js @@ -182,7 +182,6 @@ describe('ReactFlightDOMBrowser', () => { }); }); - // @gate enableUseHook it('should progressively reveal server components', async () => { let reportedErrors = []; @@ -492,7 +491,6 @@ describe('ReactFlightDOMBrowser', () => { expect(isDone).toBeTruthy(); }); - // @gate enableUseHook it('should be able to complete after aborting and throw the reason client-side', async () => { const reportedErrors = []; @@ -576,7 +574,6 @@ describe('ReactFlightDOMBrowser', () => { expect(reportedErrors).toEqual(['for reasons']); }); - // @gate enableUseHook it('basic use(promise)', async () => { function Server() { return ( @@ -605,7 +602,6 @@ describe('ReactFlightDOMBrowser', () => { expect(container.innerHTML).toBe('ABC'); }); - // @gate enableUseHook it('basic use(context)', async () => { const ContextA = React.createServerContext('ContextA', ''); const ContextB = React.createServerContext('ContextB', 'B'); @@ -639,7 +635,6 @@ describe('ReactFlightDOMBrowser', () => { expect(container.innerHTML).toBe('AB'); }); - // @gate enableUseHook it('use(promise) in multiple components', async () => { function Child({prefix}) { return prefix + use(Promise.resolve('C')) + use(Promise.resolve('D')); @@ -670,7 +665,6 @@ describe('ReactFlightDOMBrowser', () => { expect(container.innerHTML).toBe('ABCD'); }); - // @gate enableUseHook it('using a rejected promise will throw', async () => { const promiseA = Promise.resolve('A'); const promiseB = Promise.reject(new Error('Oops!')); @@ -732,7 +726,6 @@ describe('ReactFlightDOMBrowser', () => { expect(reportedErrors[0].message).toBe('Oops!'); }); - // @gate enableUseHook it("use a promise that's already been instrumented and resolved", async () => { const thenable = { status: 'fulfilled', @@ -760,7 +753,6 @@ describe('ReactFlightDOMBrowser', () => { expect(container.innerHTML).toBe('Hi'); }); - // @gate enableUseHook it('unwraps thenable that fulfills synchronously without suspending', async () => { function Server() { const thenable = { diff --git a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMEdge-test.js b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMEdge-test.js index e090add747cea..ee110d483d711 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMEdge-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMEdge-test.js @@ -54,7 +54,6 @@ describe('ReactFlightDOMEdge', () => { } } - // @gate enableUseHook it('should allow an alternative module mapping to be used for SSR', async () => { function ClientComponent() { return Client Component; diff --git a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMNode-test.js b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMNode-test.js index 17b65bcddf786..c720b4434cdf9 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMNode-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMNode-test.js @@ -56,7 +56,6 @@ describe('ReactFlightDOMNode', () => { }); } - // @gate enableUseHook it('should allow an alternative module mapping to be used for SSR', async () => { function ClientComponent() { return Client Component; diff --git a/packages/react-server/src/ReactFizzHooks.js b/packages/react-server/src/ReactFizzHooks.js index a389c092618ed..62e4586f74590 100644 --- a/packages/react-server/src/ReactFizzHooks.js +++ b/packages/react-server/src/ReactFizzHooks.js @@ -31,7 +31,6 @@ import {makeId} from './ReactFizzConfig'; import { enableCache, - enableUseHook, enableUseEffectEventHook, enableUseMemoCacheHook, } from 'shared/ReactFeatureFlags'; @@ -610,6 +609,7 @@ function noop(): void {} export const HooksDispatcher: Dispatcher = { readContext, + use, useContext, useMemo, useReducer, @@ -641,9 +641,6 @@ if (enableUseEffectEventHook) { if (enableUseMemoCacheHook) { HooksDispatcher.useMemoCache = useMemoCache; } -if (enableUseHook) { - HooksDispatcher.use = use; -} export let currentResponseState: null | ResponseState = (null: any); export function setCurrentResponseState( diff --git a/packages/react-server/src/ReactFlightHooks.js b/packages/react-server/src/ReactFlightHooks.js index 270e1f24007b2..190292515efb3 100644 --- a/packages/react-server/src/ReactFlightHooks.js +++ b/packages/react-server/src/ReactFlightHooks.js @@ -16,7 +16,6 @@ import { REACT_MEMO_CACHE_SENTINEL, } from 'shared/ReactSymbols'; import {readContext as readContextImpl} from './ReactFlightNewContext'; -import {enableUseHook} from 'shared/ReactFeatureFlags'; import {createThenableState, trackUsedThenable} from './ReactFlightThenable'; import {isClientReference} from './ReactFlightServerConfig'; @@ -100,7 +99,7 @@ export const HooksDispatcher: Dispatcher = { } return data; }, - use: enableUseHook ? use : (unsupportedHook: any), + use, }; function unsupportedHook(): void { diff --git a/packages/react/src/__tests__/ReactFetch-test.js b/packages/react/src/__tests__/ReactFetch-test.js index 2993ed564cdbd..b3f8843b8856e 100644 --- a/packages/react/src/__tests__/ReactFetch-test.js +++ b/packages/react/src/__tests__/ReactFetch-test.js @@ -135,7 +135,6 @@ describe('ReactFetch', () => { expect(fetchCount).toBe(1); }); - // @gate enableUseHook it('can opt-out of deduping fetches inside of render with custom signal', async () => { const controller = new AbortController(); function useCustomHook() { @@ -154,7 +153,6 @@ describe('ReactFetch', () => { expect(fetchCount).not.toBe(1); }); - // @gate enableUseHook it('opts out of deduping for POST requests', async () => { function useCustomHook() { return use( diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 6129bb1476f59..791ed622a0ff6 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -106,8 +106,6 @@ export const enableHostSingletons = true; export const enableFloat = true; -export const enableUseHook = true; - // Enables unstable_useMemoCache hook, intended as a compilation target for // auto-memoization. export const enableUseMemoCacheHook = __EXPERIMENTAL__; diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index 9345b0bb85ff3..239228901600d 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -53,7 +53,6 @@ export const disableModulePatternComponents = false; export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCPUSuspense = true; -export const enableUseHook = true; export const enableUseMemoCacheHook = true; export const enableUseEffectEventHook = false; export const enableClientRenderFallbackOnTextMismatch = true; diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index c5888b2837c50..326f7d5385b46 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -39,7 +39,6 @@ export const disableModulePatternComponents = false; export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCPUSuspense = false; -export const enableUseHook = true; export const enableUseMemoCacheHook = false; export const enableUseEffectEventHook = false; export const enableClientRenderFallbackOnTextMismatch = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index 63f3c9f6eb206..f3d296f257c92 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -39,7 +39,6 @@ export const disableModulePatternComponents = false; export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCPUSuspense = false; -export const enableUseHook = true; export const enableUseMemoCacheHook = false; export const enableUseEffectEventHook = false; export const enableClientRenderFallbackOnTextMismatch = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js index 771362d6bfecb..751695f8eb0b1 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js @@ -43,7 +43,6 @@ export const enableGetInspectorDataForInstanceInProduction = false; export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCPUSuspense = false; -export const enableUseHook = true; export const enableUseMemoCacheHook = false; export const enableUseEffectEventHook = false; export const enableClientRenderFallbackOnTextMismatch = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index 433d18d918247..31d2292dcf4e8 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -39,7 +39,6 @@ export const disableModulePatternComponents = true; export const enableSuspenseAvoidThisFallback = true; export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCPUSuspense = false; -export const enableUseHook = true; export const enableUseMemoCacheHook = false; export const enableUseEffectEventHook = false; export const enableClientRenderFallbackOnTextMismatch = true; diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index a4a64c0d93e81..949811e68148e 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -51,7 +51,6 @@ export const enableSuspenseAvoidThisFallbackFizz = false; export const disableSchedulerTimeoutInWorkLoop = false; export const enableCPUSuspense = true; export const enableFloat = true; -export const enableUseHook = true; export const enableUseMemoCacheHook = true; export const enableUseEffectEventHook = true; export const enableHostSingletons = true;