From bf5292bb2e544f15eba5536a1656b62bd4e9ec88 Mon Sep 17 00:00:00 2001 From: Josh Story Date: Tue, 2 Apr 2024 08:24:24 -0700 Subject: [PATCH] [FB] disable legacy mode in modern build Disables legacy mode in www-modern and removes the entrypoint hack in tests since we gate legacy mode tests now Additionally disables test utils because this relies on legacy mode. Additionally gates react-test-renderer test for unstable_Scope because it seems to also rely on legacy roots. --- packages/react-dom/src/__tests__/ReactDOMRoot-test.js | 4 ++-- packages/react/index.modern.fb.js | 3 ++- scripts/jest/setupHostConfigs.js | 5 ----- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js index cdfb267006b1e..45f6fc095c2d2 100644 --- a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js @@ -47,7 +47,7 @@ describe('ReactDOMRoot', () => { expect(container.textContent).toEqual('Hi'); }); - // @gate !classic || !__DEV__ + // @gate !www || !__DEV__ it('warns if you import createRoot from react-dom', async () => { expect(() => ReactDOM.createRoot(container)).toErrorDev( 'You are importing createRoot from "react-dom" which is not supported. ' + @@ -58,7 +58,7 @@ describe('ReactDOMRoot', () => { ); }); - // @gate !classic || !__DEV__ + // @gate !www || !__DEV__ it('warns if you import hydrateRoot from react-dom', async () => { expect(() => ReactDOM.hydrateRoot(container, null)).toErrorDev( 'You are importing hydrateRoot from "react-dom" which is not supported. ' + diff --git a/packages/react/index.modern.fb.js b/packages/react/index.modern.fb.js index f0b5e03925530..85a620595188e 100644 --- a/packages/react/index.modern.fb.js +++ b/packages/react/index.modern.fb.js @@ -33,6 +33,7 @@ export { unstable_Activity, unstable_Scope, unstable_SuspenseList, + unstable_TracingMarker, unstable_getCacheForType, unstable_useCacheRefresh, unstable_useMemoCache, @@ -48,10 +49,10 @@ export { useLayoutEffect, useMemo, useOptimistic, + useSyncExternalStore, useReducer, useRef, useState, - useSyncExternalStore, useTransition, useActionState, version, diff --git a/scripts/jest/setupHostConfigs.js b/scripts/jest/setupHostConfigs.js index 5fde144c255e3..1c4acabde5bbd 100644 --- a/scripts/jest/setupHostConfigs.js +++ b/scripts/jest/setupHostConfigs.js @@ -14,11 +14,6 @@ function resolveEntryFork(resolvedEntry, isFBBundle) { // .js if (isFBBundle) { - if (__EXPERIMENTAL__) { - // We can't currently use the true modern entry point because too many tests fail. - // TODO: Fix tests to not use ReactDOM.render or gate them. Then we can remove this. - return resolvedEntry; - } const resolvedFBEntry = resolvedEntry.replace( '.js', __EXPERIMENTAL__ ? '.modern.fb.js' : '.classic.fb.js'