Skip to content

Commit d16d5ca

Browse files
committed
[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.
1 parent 8833338 commit d16d5ca

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

packages/react-dom/src/__tests__/ReactDOMRoot-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('ReactDOMRoot', () => {
4747
expect(container.textContent).toEqual('Hi');
4848
});
4949

50-
// @gate !classic || !__DEV__
50+
// @gate !disableLegacyMode
5151
it('warns if you import createRoot from react-dom', async () => {
5252
expect(() => ReactDOM.createRoot(container)).toErrorDev(
5353
'You are importing createRoot from "react-dom" which is not supported. ' +
@@ -58,7 +58,7 @@ describe('ReactDOMRoot', () => {
5858
);
5959
});
6060

61-
// @gate !classic || !__DEV__
61+
// @gate !disableLegacyMode
6262
it('warns if you import hydrateRoot from react-dom', async () => {
6363
expect(() => ReactDOM.hydrateRoot(container, null)).toErrorDev(
6464
'You are importing hydrateRoot from "react-dom" which is not supported. ' +

packages/react-reconciler/src/__tests__/ReactScope-test.internal.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ describe('ReactScope', () => {
393393
});
394394

395395
// @gate www
396+
// @gate !disableLegacyMode
396397
it('DO_NOT_USE_queryAllNodes() works as intended', () => {
397398
const testScopeQuery = (type, props) => true;
398399
const TestScope = React.unstable_Scope;
@@ -430,6 +431,7 @@ describe('ReactScope', () => {
430431
});
431432

432433
// @gate www
434+
// @gate !disableLegacyMode
433435
it('DO_NOT_USE_queryFirstNode() works as intended', () => {
434436
const testScopeQuery = (type, props) => true;
435437
const TestScope = React.unstable_Scope;
@@ -467,6 +469,7 @@ describe('ReactScope', () => {
467469
});
468470

469471
// @gate www
472+
// @gate !disableLegacyMode
470473
it('containsNode() works as intended', () => {
471474
const TestScope = React.unstable_Scope;
472475
const scopeRef = React.createRef();

packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ describe('ReactSuspense', () => {
379379
});
380380

381381
// @gate forceConcurrentByDefaultForTesting
382+
// @gate !disableLegacyMode
382383
it(
383384
'interrupts current render when something suspends with a ' +
384385
"delay and we've already skipped over a lower priority update in " +

packages/shared/forks/ReactFeatureFlags.www.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,10 @@ export const useModernStrictMode = true;
114114
// because JSX is an extremely hot path.
115115
export const disableStringRefs = false;
116116

117-
export const disableLegacyMode = false;
118-
119-
export const disableDOMTestUtils = false;
117+
// These flags need to be on together because disabled legacy mode breaks test utils
118+
// since it is written on top of legacy mode
119+
export const disableLegacyMode = __EXPERIMENTAL__;
120+
export const disableDOMTestUtils = __EXPERIMENTAL__;
120121

121122
// Flow magic to verify the exports of this file match the original version.
122123
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

scripts/jest/setupHostConfigs.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ function resolveEntryFork(resolvedEntry, isFBBundle) {
1414
// .js
1515

1616
if (isFBBundle) {
17-
if (__EXPERIMENTAL__) {
18-
// We can't currently use the true modern entry point because too many tests fail.
19-
// TODO: Fix tests to not use ReactDOM.render or gate them. Then we can remove this.
20-
return resolvedEntry;
21-
}
2217
const resolvedFBEntry = resolvedEntry.replace(
2318
'.js',
2419
__EXPERIMENTAL__ ? '.modern.fb.js' : '.classic.fb.js'

0 commit comments

Comments
 (0)