From 0de3ddf56e011c708067319d9b8e94e1cd1ea1a5 Mon Sep 17 00:00:00 2001 From: Ricky Date: Thu, 25 Aug 2022 17:01:30 -0400 Subject: [PATCH] Remove Symbol Polyfill (again) (#25144) --- .../react/src/__tests__/ReactElement-test.js | 147 ----------------- .../src/__tests__/ReactElementJSX-test.js | 154 ------------------ packages/shared/ReactFeatureFlags.js | 3 - packages/shared/ReactSymbols.www.js | 93 ----------- .../__tests__/ReactSymbols-test.internal.js | 16 -- .../forks/ReactFeatureFlags.native-fb.js | 1 - .../forks/ReactFeatureFlags.native-oss.js | 1 - .../forks/ReactFeatureFlags.test-renderer.js | 1 - .../ReactFeatureFlags.test-renderer.native.js | 1 - .../ReactFeatureFlags.test-renderer.www.js | 1 - .../shared/forks/ReactFeatureFlags.testing.js | 1 - .../forks/ReactFeatureFlags.testing.www.js | 1 - .../forks/ReactFeatureFlags.www-dynamic.js | 1 - .../shared/forks/ReactFeatureFlags.www.js | 1 - packages/shared/isValidElementType.js | 12 +- scripts/jest/setupTests.www.js | 4 - scripts/rollup/forks.js | 11 -- 17 files changed, 1 insertion(+), 448 deletions(-) delete mode 100644 packages/shared/ReactSymbols.www.js diff --git a/packages/react/src/__tests__/ReactElement-test.js b/packages/react/src/__tests__/ReactElement-test.js index 95499947b80fc..0e8a72e2f3888 100644 --- a/packages/react/src/__tests__/ReactElement-test.js +++ b/packages/react/src/__tests__/ReactElement-test.js @@ -9,26 +9,16 @@ 'use strict'; -import {enableSymbolFallbackForWWW} from 'shared/ReactFeatureFlags'; - let React; let ReactDOM; let ReactTestUtils; describe('ReactElement', () => { let ComponentClass; - let originalSymbol; beforeEach(() => { jest.resetModules(); - if (enableSymbolFallbackForWWW) { - // Delete the native Symbol if we have one to ensure we test the - // unpolyfilled environment. - originalSymbol = global.Symbol; - global.Symbol = undefined; - } - React = require('react'); ReactDOM = require('react-dom'); ReactTestUtils = require('react-dom/test-utils'); @@ -41,17 +31,6 @@ describe('ReactElement', () => { }; }); - afterEach(() => { - if (enableSymbolFallbackForWWW) { - global.Symbol = originalSymbol; - } - }); - - // @gate enableSymbolFallbackForWWW - it('uses the fallback value when in an environment without Symbol', () => { - expect((
).$$typeof).toBe(0xeac7); - }); - it('returns a complete element according to spec', () => { const element = React.createElement(ComponentClass); expect(element.type).toBe(ComponentClass); @@ -301,42 +280,6 @@ describe('ReactElement', () => { expect(element.type.someStaticMethod()).toBe('someReturnValue'); }); - // NOTE: We're explicitly not using JSX here. This is intended to test - // classic JS without JSX. - // @gate enableSymbolFallbackForWWW - it('identifies valid elements', () => { - class Component extends React.Component { - render() { - return React.createElement('div'); - } - } - - expect(React.isValidElement(React.createElement('div'))).toEqual(true); - expect(React.isValidElement(React.createElement(Component))).toEqual(true); - - expect(React.isValidElement(null)).toEqual(false); - expect(React.isValidElement(true)).toEqual(false); - expect(React.isValidElement({})).toEqual(false); - expect(React.isValidElement('string')).toEqual(false); - if (!__EXPERIMENTAL__) { - let factory; - expect(() => { - factory = React.createFactory('div'); - }).toWarnDev( - 'Warning: React.createFactory() is deprecated and will be removed in a ' + - 'future major release. Consider using JSX or use React.createElement() ' + - 'directly instead.', - {withoutStack: true}, - ); - expect(React.isValidElement(factory)).toEqual(false); - } - expect(React.isValidElement(Component)).toEqual(false); - expect(React.isValidElement({type: 'div', props: {}})).toEqual(false); - - const jsonElement = JSON.stringify(React.createElement('div')); - expect(React.isValidElement(JSON.parse(jsonElement))).toBe(true); - }); - // NOTE: We're explicitly not using JSX here. This is intended to test // classic JS without JSX. it('is indistinguishable from a plain object', () => { @@ -451,94 +394,4 @@ describe('ReactElement', () => { const test = ReactTestUtils.renderIntoDocument(); expect(test.props.value).toBeNaN(); }); - - // NOTE: We're explicitly not using JSX here. This is intended to test - // classic JS without JSX. - // @gate !enableSymbolFallbackForWWW - it('identifies elements, but not JSON, if Symbols are supported', () => { - class Component extends React.Component { - render() { - return React.createElement('div'); - } - } - - expect(React.isValidElement(React.createElement('div'))).toEqual(true); - expect(React.isValidElement(React.createElement(Component))).toEqual(true); - - expect(React.isValidElement(null)).toEqual(false); - expect(React.isValidElement(true)).toEqual(false); - expect(React.isValidElement({})).toEqual(false); - expect(React.isValidElement('string')).toEqual(false); - if (!__EXPERIMENTAL__) { - let factory; - expect(() => { - factory = React.createFactory('div'); - }).toWarnDev( - 'Warning: React.createFactory() is deprecated and will be removed in a ' + - 'future major release. Consider using JSX or use React.createElement() ' + - 'directly instead.', - {withoutStack: true}, - ); - expect(React.isValidElement(factory)).toEqual(false); - } - expect(React.isValidElement(Component)).toEqual(false); - expect(React.isValidElement({type: 'div', props: {}})).toEqual(false); - - const jsonElement = JSON.stringify(React.createElement('div')); - expect(React.isValidElement(JSON.parse(jsonElement))).toBe(false); - }); - - // NOTE: We're explicitly not using JSX here. This is intended to test - // classic JS without JSX. - it('identifies elements, but not JSON, if Symbols are supported (with polyfill)', () => { - // Rudimentary polyfill - // Once all jest engines support Symbols natively we can swap this to test - // WITH native Symbols by default. - const REACT_ELEMENT_TYPE = function() {}; // fake Symbol - const OTHER_SYMBOL = function() {}; // another fake Symbol - global.Symbol = function(name) { - return OTHER_SYMBOL; - }; - global.Symbol.for = function(key) { - if (key === 'react.element') { - return REACT_ELEMENT_TYPE; - } - return OTHER_SYMBOL; - }; - - jest.resetModules(); - - React = require('react'); - - class Component extends React.Component { - render() { - return React.createElement('div'); - } - } - - expect(React.isValidElement(React.createElement('div'))).toEqual(true); - expect(React.isValidElement(React.createElement(Component))).toEqual(true); - - expect(React.isValidElement(null)).toEqual(false); - expect(React.isValidElement(true)).toEqual(false); - expect(React.isValidElement({})).toEqual(false); - expect(React.isValidElement('string')).toEqual(false); - if (!__EXPERIMENTAL__) { - let factory; - expect(() => { - factory = React.createFactory('div'); - }).toWarnDev( - 'Warning: React.createFactory() is deprecated and will be removed in a ' + - 'future major release. Consider using JSX or use React.createElement() ' + - 'directly instead.', - {withoutStack: true}, - ); - expect(React.isValidElement(factory)).toEqual(false); - } - expect(React.isValidElement(Component)).toEqual(false); - expect(React.isValidElement({type: 'div', props: {}})).toEqual(false); - - const jsonElement = JSON.stringify(React.createElement('div')); - expect(React.isValidElement(JSON.parse(jsonElement))).toBe(false); - }); }); diff --git a/packages/react/src/__tests__/ReactElementJSX-test.js b/packages/react/src/__tests__/ReactElementJSX-test.js index 16b53923ffb5d..1a4f535a0b2f9 100644 --- a/packages/react/src/__tests__/ReactElementJSX-test.js +++ b/packages/react/src/__tests__/ReactElementJSX-test.js @@ -9,8 +9,6 @@ 'use strict'; -import {enableSymbolFallbackForWWW} from 'shared/ReactFeatureFlags'; - let React; let ReactDOM; let ReactTestUtils; @@ -22,18 +20,9 @@ let JSXDEVRuntime; // A lot of these tests are pulled from ReactElement-test because // this api is meant to be backwards compatible. describe('ReactElement.jsx', () => { - let originalSymbol; - beforeEach(() => { jest.resetModules(); - if (enableSymbolFallbackForWWW) { - // Delete the native Symbol if we have one to ensure we test the - // unpolyfilled environment. - originalSymbol = global.Symbol; - global.Symbol = undefined; - } - React = require('react'); JSXRuntime = require('react/jsx-runtime'); JSXDEVRuntime = require('react/jsx-dev-runtime'); @@ -41,12 +30,6 @@ describe('ReactElement.jsx', () => { ReactTestUtils = require('react-dom/test-utils'); }); - afterEach(() => { - if (enableSymbolFallbackForWWW) { - global.Symbol = originalSymbol; - } - }); - it('allows static methods to be called using the type property', () => { class StaticMethodComponentClass extends React.Component { render() { @@ -59,48 +42,6 @@ describe('ReactElement.jsx', () => { expect(element.type.someStaticMethod()).toBe('someReturnValue'); }); - // @gate enableSymbolFallbackForWWW - it('identifies valid elements', () => { - class Component extends React.Component { - render() { - return JSXRuntime.jsx('div', {}); - } - } - - expect(React.isValidElement(JSXRuntime.jsx('div', {}))).toEqual(true); - expect(React.isValidElement(JSXRuntime.jsx(Component, {}))).toEqual(true); - expect( - React.isValidElement(JSXRuntime.jsx(JSXRuntime.Fragment, {})), - ).toEqual(true); - if (__DEV__) { - expect(React.isValidElement(JSXDEVRuntime.jsxDEV('div', {}))).toEqual( - true, - ); - } - - expect(React.isValidElement(null)).toEqual(false); - expect(React.isValidElement(true)).toEqual(false); - expect(React.isValidElement({})).toEqual(false); - expect(React.isValidElement('string')).toEqual(false); - if (!__EXPERIMENTAL__) { - let factory; - expect(() => { - factory = React.createFactory('div'); - }).toWarnDev( - 'Warning: React.createFactory() is deprecated and will be removed in a ' + - 'future major release. Consider using JSX or use React.createElement() ' + - 'directly instead.', - {withoutStack: true}, - ); - expect(React.isValidElement(factory)).toEqual(false); - } - expect(React.isValidElement(Component)).toEqual(false); - expect(React.isValidElement({type: 'div', props: {}})).toEqual(false); - - const jsonElement = JSON.stringify(JSXRuntime.jsx('div', {})); - expect(React.isValidElement(JSON.parse(jsonElement))).toBe(true); - }); - it('is indistinguishable from a plain object', () => { const element = JSXRuntime.jsx('div', {className: 'foo'}); const object = {}; @@ -294,101 +235,6 @@ describe('ReactElement.jsx', () => { ); }); - // @gate !enableSymbolFallbackForWWW - it('identifies elements, but not JSON, if Symbols are supported', () => { - class Component extends React.Component { - render() { - return JSXRuntime.jsx('div', {}); - } - } - - expect(React.isValidElement(JSXRuntime.jsx('div', {}))).toEqual(true); - expect(React.isValidElement(JSXRuntime.jsx(Component, {}))).toEqual(true); - expect( - React.isValidElement(JSXRuntime.jsx(JSXRuntime.Fragment, {})), - ).toEqual(true); - if (__DEV__) { - expect(React.isValidElement(JSXDEVRuntime.jsxDEV('div', {}))).toEqual( - true, - ); - } - - expect(React.isValidElement(null)).toEqual(false); - expect(React.isValidElement(true)).toEqual(false); - expect(React.isValidElement({})).toEqual(false); - expect(React.isValidElement('string')).toEqual(false); - if (!__EXPERIMENTAL__) { - let factory; - expect(() => { - factory = React.createFactory('div'); - }).toWarnDev( - 'Warning: React.createFactory() is deprecated and will be removed in a ' + - 'future major release. Consider using JSX or use React.createElement() ' + - 'directly instead.', - {withoutStack: true}, - ); - expect(React.isValidElement(factory)).toEqual(false); - } - expect(React.isValidElement(Component)).toEqual(false); - expect(React.isValidElement({type: 'div', props: {}})).toEqual(false); - - const jsonElement = JSON.stringify(JSXRuntime.jsx('div', {})); - expect(React.isValidElement(JSON.parse(jsonElement))).toBe(false); - }); - - it('identifies elements, but not JSON, if Symbols are polyfilled', () => { - // Rudimentary polyfill - // Once all jest engines support Symbols natively we can swap this to test - // WITH native Symbols by default. - const REACT_ELEMENT_TYPE = function() {}; // fake Symbol - const OTHER_SYMBOL = function() {}; // another fake Symbol - global.Symbol = function(name) { - return OTHER_SYMBOL; - }; - global.Symbol.for = function(key) { - if (key === 'react.element') { - return REACT_ELEMENT_TYPE; - } - return OTHER_SYMBOL; - }; - - jest.resetModules(); - - React = require('react'); - JSXRuntime = require('react/jsx-runtime'); - - class Component extends React.Component { - render() { - return JSXRuntime.jsx('div'); - } - } - - expect(React.isValidElement(JSXRuntime.jsx('div', {}))).toEqual(true); - expect(React.isValidElement(JSXRuntime.jsx(Component, {}))).toEqual(true); - - expect(React.isValidElement(null)).toEqual(false); - expect(React.isValidElement(true)).toEqual(false); - expect(React.isValidElement({})).toEqual(false); - expect(React.isValidElement('string')).toEqual(false); - if (!__EXPERIMENTAL__) { - let factory; - expect(() => { - factory = React.createFactory('div'); - }).toWarnDev( - 'Warning: React.createFactory() is deprecated and will be removed in a ' + - 'future major release. Consider using JSX or use React.createElement() ' + - 'directly instead.', - {withoutStack: true}, - ); - expect(React.isValidElement(factory)).toEqual(false); - } - expect(React.isValidElement(Component)).toEqual(false); - expect(React.isValidElement({type: 'div', props: {}})).toEqual(false); - - const jsonElement = JSON.stringify(JSXRuntime.jsx('div', {})); - expect(React.isValidElement(JSON.parse(jsonElement))).toBe(false); - }); - it('should warn when unkeyed children are passed to jsx', () => { const container = document.createElement('div'); diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 197124fd233e7..ba7fcb61a613c 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -24,9 +24,6 @@ export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; // like migrating internal callers or performance testing. // ----------------------------------------------------------------------------- -// This is blocked on adding a symbol polyfill to www. -export const enableSymbolFallbackForWWW = false; - // This rolled out to 10% public in www, so we should be able to land, but some // internal tests need to be updated. The open source behavior is correct. export const skipUnmountedBoundaries = true; diff --git a/packages/shared/ReactSymbols.www.js b/packages/shared/ReactSymbols.www.js deleted file mode 100644 index 523cc1436dfc2..0000000000000 --- a/packages/shared/ReactSymbols.www.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - */ - -// ATTENTION -// When adding new symbols to this file, -// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' - -import {enableSymbolFallbackForWWW} from './ReactFeatureFlags'; - -const usePolyfill = - enableSymbolFallbackForWWW && (typeof Symbol !== 'function' || !Symbol.for); - -// The Symbol used to tag the ReactElement-like types. -export const REACT_ELEMENT_TYPE = usePolyfill - ? 0xeac7 - : Symbol.for('react.element'); -export const REACT_PORTAL_TYPE = usePolyfill - ? 0xeaca - : Symbol.for('react.portal'); -export const REACT_FRAGMENT_TYPE = usePolyfill - ? 0xeacb - : Symbol.for('react.fragment'); -export const REACT_STRICT_MODE_TYPE = usePolyfill - ? 0xeacc - : Symbol.for('react.strict_mode'); -export const REACT_PROFILER_TYPE = usePolyfill - ? 0xead2 - : Symbol.for('react.profiler'); -export const REACT_PROVIDER_TYPE = usePolyfill - ? 0xeacd - : Symbol.for('react.provider'); -export const REACT_CONTEXT_TYPE = usePolyfill - ? 0xeace - : Symbol.for('react.context'); -export const REACT_SERVER_CONTEXT_TYPE = usePolyfill - ? 0xeae6 - : Symbol.for('react.server_context'); -export const REACT_FORWARD_REF_TYPE = usePolyfill - ? 0xead0 - : Symbol.for('react.forward_ref'); -export const REACT_SUSPENSE_TYPE = usePolyfill - ? 0xead1 - : Symbol.for('react.suspense'); -export const REACT_SUSPENSE_LIST_TYPE = usePolyfill - ? 0xead8 - : Symbol.for('react.suspense_list'); -export const REACT_MEMO_TYPE = usePolyfill ? 0xead3 : Symbol.for('react.memo'); -export const REACT_LAZY_TYPE = usePolyfill ? 0xead4 : Symbol.for('react.lazy'); -export const REACT_SCOPE_TYPE = usePolyfill - ? 0xead7 - : Symbol.for('react.scope'); -export const REACT_DEBUG_TRACING_MODE_TYPE = usePolyfill - ? 0xeae1 - : Symbol.for('react.debug_trace_mode'); -export const REACT_OFFSCREEN_TYPE = usePolyfill - ? 0xeae2 - : Symbol.for('react.offscreen'); -export const REACT_LEGACY_HIDDEN_TYPE = usePolyfill - ? 0xeae3 - : Symbol.for('react.legacy_hidden'); -export const REACT_CACHE_TYPE = usePolyfill - ? 0xeae4 - : Symbol.for('react.cache'); -export const REACT_TRACING_MARKER_TYPE = usePolyfill - ? 0xeae5 - : Symbol.for('react.tracing_marker'); -export const REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = usePolyfill - ? 0xeae7 - : Symbol.for('react.default_value'); -const MAYBE_ITERATOR_SYMBOL = usePolyfill - ? typeof Symbol === 'function' && Symbol.iterator - : Symbol.iterator; - -const FAUX_ITERATOR_SYMBOL = '@@iterator'; - -export function getIteratorFn(maybeIterable: ?any): ?() => ?Iterator<*> { - if (maybeIterable === null || typeof maybeIterable !== 'object') { - return null; - } - const maybeIterator = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable[FAUX_ITERATOR_SYMBOL]; - if (typeof maybeIterator === 'function') { - return maybeIterator; - } - return null; -} diff --git a/packages/shared/__tests__/ReactSymbols-test.internal.js b/packages/shared/__tests__/ReactSymbols-test.internal.js index 4b6a2d0bc61c0..53618ba3fe4fa 100644 --- a/packages/shared/__tests__/ReactSymbols-test.internal.js +++ b/packages/shared/__tests__/ReactSymbols-test.internal.js @@ -26,20 +26,4 @@ describe('ReactSymbols', () => { it('Symbol values should be unique', () => { expectToBeUnique(Object.entries(require('shared/ReactSymbols'))); }); - - // @gate enableSymbolFallbackForWWW - it('numeric values should be unique', () => { - const originalSymbolFor = global.Symbol.for; - global.Symbol.for = null; - try { - const entries = Object.entries(require('shared/ReactSymbols.www')).filter( - // REACT_ASYNC_MODE_TYPE and REACT_CONCURRENT_MODE_TYPE have the same numeric value - // for legacy backwards compatibility - ([key]) => key !== 'REACT_ASYNC_MODE_TYPE', - ); - expectToBeUnique(entries); - } finally { - global.Symbol.for = originalSymbolFor; - } - }); }); diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index 785aae48b7acd..76f19551875ba 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -81,7 +81,6 @@ export const enableServerContext = false; export const enableUseMutableSource = true; export const enableTransitionTracing = false; -export const enableSymbolFallbackForWWW = false; export const enableFloat = false; // Flow magic to verify the exports of this file match the original version. diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index 29e28584ca8f7..6de6388896c23 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -70,7 +70,6 @@ export const enableServerContext = false; export const enableUseMutableSource = false; export const enableTransitionTracing = false; -export const enableSymbolFallbackForWWW = false; export const enableFloat = false; // Flow magic to verify the exports of this file match the original version. diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index ac08f57552c4f..1ac2ff4f2acf0 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -70,7 +70,6 @@ export const enableServerContext = false; export const enableUseMutableSource = false; export const enableTransitionTracing = false; -export const enableSymbolFallbackForWWW = false; export const enableFloat = false; // Flow magic to verify the exports of this file match the original version. diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js index 9408f5d7adb15..8b3d4e230d438 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js @@ -68,7 +68,6 @@ export const enableServerContext = false; export const enableUseMutableSource = false; export const enableTransitionTracing = false; -export const enableSymbolFallbackForWWW = false; export const enableFloat = false; // Flow magic to verify the exports of this file match the original version. diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index 990d1a4a9053e..e414784563f3c 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -72,7 +72,6 @@ export const enableServerContext = false; export const enableUseMutableSource = true; export const enableTransitionTracing = false; -export const enableSymbolFallbackForWWW = false; export const enableFloat = false; // Flow magic to verify the exports of this file match the original version. diff --git a/packages/shared/forks/ReactFeatureFlags.testing.js b/packages/shared/forks/ReactFeatureFlags.testing.js index 7698cde8231c6..0d719ca3523d2 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.js @@ -70,7 +70,6 @@ export const enableServerContext = false; export const enableUseMutableSource = false; export const enableTransitionTracing = false; -export const enableSymbolFallbackForWWW = false; export const enableFloat = false; // Flow magic to verify the exports of this file match the original version. diff --git a/packages/shared/forks/ReactFeatureFlags.testing.www.js b/packages/shared/forks/ReactFeatureFlags.testing.www.js index e6768ca0fdb08..6d2cd32d9f86b 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.www.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.www.js @@ -71,7 +71,6 @@ export const enableServerContext = false; export const enableUseMutableSource = true; export const enableTransitionTracing = false; -export const enableSymbolFallbackForWWW = false; export const enableFloat = false; // Flow magic to verify the exports of this file match the original version. diff --git a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js index dd6dcff47b307..520b102b7d3fc 100644 --- a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js +++ b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js @@ -28,7 +28,6 @@ export const consoleManagedByDevToolsDuringStrictMode = __VARIANT__; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = __VARIANT__; export const enableClientRenderFallbackOnTextMismatch = __VARIANT__; export const enableTransitionTracing = __VARIANT__; -export const enableSymbolFallbackForWWW = __VARIANT__; // Enable this flag to help with concurrent mode debugging. // It logs information to the console about React scheduling, rendering, and commit phases. // diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index 985c593c03030..2c59dde3a11b6 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -110,7 +110,6 @@ export const enableUseMutableSource = true; export const enableCustomElementPropertySupport = __EXPERIMENTAL__; -export const enableSymbolFallbackForWWW = true; // Flow magic to verify the exports of this file match the original version. // eslint-disable-next-line no-unused-vars type Check<_X, Y: _X, X: Y = _X> = null; diff --git a/packages/shared/isValidElementType.js b/packages/shared/isValidElementType.js index 598a53666f60c..87424982afc11 100644 --- a/packages/shared/isValidElementType.js +++ b/packages/shared/isValidElementType.js @@ -31,19 +31,9 @@ import { enableTransitionTracing, enableDebugTracing, enableLegacyHidden, - enableSymbolFallbackForWWW, } from './ReactFeatureFlags'; -let REACT_MODULE_REFERENCE; -if (enableSymbolFallbackForWWW) { - if (typeof Symbol === 'function') { - REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); - } else { - REACT_MODULE_REFERENCE = 0; - } -} else { - REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); -} +const REACT_MODULE_REFERENCE: Symbol = Symbol.for('react.module.reference'); export default function isValidElementType(type: mixed) { if (typeof type === 'string' || typeof type === 'function') { diff --git a/scripts/jest/setupTests.www.js b/scripts/jest/setupTests.www.js index e80448db4e078..c0058cb6e0849 100644 --- a/scripts/jest/setupTests.www.js +++ b/scripts/jest/setupTests.www.js @@ -19,10 +19,6 @@ jest.mock('shared/ReactFeatureFlags', () => { return wwwFlags; }); -jest.mock('shared/ReactSymbols', () => { - return jest.requireActual('shared/ReactSymbols.www'); -}); - jest.mock('scheduler/src/SchedulerFeatureFlags', () => { const schedulerSrcPath = process.cwd() + '/packages/scheduler'; jest.mock( diff --git a/scripts/rollup/forks.js b/scripts/rollup/forks.js index 5c3abebc5e495..d45c41a74268d 100644 --- a/scripts/rollup/forks.js +++ b/scripts/rollup/forks.js @@ -138,17 +138,6 @@ const forks = Object.freeze({ return null; }, - './packages/shared/ReactSymbols.js': bundleType => { - switch (bundleType) { - case FB_WWW_DEV: - case FB_WWW_PROD: - case FB_WWW_PROFILING: - return './packages/shared/ReactSymbols.www.js'; - default: - return './packages/shared/ReactSymbols.js'; - } - }, - './packages/scheduler/index.js': (bundleType, entry, dependencies) => { switch (bundleType) { case UMD_DEV: