From 7a2609eedc571049a3272e60d5f7d84601ffca3f Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Wed, 3 Apr 2024 09:25:02 -0400 Subject: [PATCH] Cleanup enableBigIntSupport flag (#28711) Cleanup enableBigIntSupport flag --- .../src/client/ReactDOMComponent.js | 13 ++----- .../src/client/ReactDOMOption.js | 3 +- .../src/client/ReactFiberConfigDOM.js | 3 +- .../src/client/ToStringValue.js | 6 ---- .../src/server/ReactFizzConfigDOM.js | 16 +++------ .../src/server/escapeTextForBrowser.js | 3 +- .../src/__tests__/ReactDOMFiber-test.js | 1 - .../src/__tests__/ReactDOMFizzServer-test.js | 13 ++----- .../src/__tests__/ReactDOMInput-test.js | 1 - .../src/__tests__/ReactDOMOption-test.js | 1 - .../ReactDOMServerIntegrationBasic-test.js | 8 ++--- .../ReactDOMServerIntegrationInput-test.js | 11 ++---- .../ReactDOMServerIntegrationSelect-test.js | 4 +-- .../ReactDOMServerIntegrationTextarea-test.js | 11 ++---- .../src/__tests__/ReactDOMTextarea-test.js | 1 - .../src/__tests__/ReactMultiChildText-test.js | 1 - .../react-reconciler/src/ReactChildFiber.js | 9 +++-- .../src/__tests__/ReactTopLevelText-test.js | 1 - packages/react-server/src/ReactFizzServer.js | 6 +--- packages/react/src/ReactChildren.js | 5 --- .../react/src/__tests__/ReactChildren-test.js | 36 ++++++------------- packages/shared/ReactFeatureFlags.js | 2 -- .../ReactFeatureFlags.native-fb-dynamic.js | 1 - .../forks/ReactFeatureFlags.native-fb.js | 1 - .../forks/ReactFeatureFlags.native-oss.js | 1 - .../forks/ReactFeatureFlags.test-renderer.js | 1 - ...actFeatureFlags.test-renderer.native-fb.js | 2 -- .../ReactFeatureFlags.test-renderer.www.js | 2 -- .../forks/ReactFeatureFlags.www-dynamic.js | 1 - .../shared/forks/ReactFeatureFlags.www.js | 1 - 30 files changed, 36 insertions(+), 129 deletions(-) diff --git a/packages/react-dom-bindings/src/client/ReactDOMComponent.js b/packages/react-dom-bindings/src/client/ReactDOMComponent.js index 4df6de538576..673fd47eca46 100644 --- a/packages/react-dom-bindings/src/client/ReactDOMComponent.js +++ b/packages/react-dom-bindings/src/client/ReactDOMComponent.js @@ -66,7 +66,6 @@ import {validateProperties as validateUnknownProperties} from '../shared/ReactDO import sanitizeURL from '../shared/sanitizeURL'; import { - enableBigIntSupport, disableIEWorkarounds, enableTrustedTypesIntegration, enableFilterEmptyStringAttributesDOM, @@ -370,10 +369,7 @@ function setProp( if (canSetTextContent) { setTextContent(domElement, value); } - } else if ( - typeof value === 'number' || - (enableBigIntSupport && typeof value === 'bigint') - ) { + } else if (typeof value === 'number' || typeof value === 'bigint') { if (__DEV__) { // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint validateTextNesting('' + value, tag); @@ -929,10 +925,7 @@ function setPropOnCustomElement( case 'children': { if (typeof value === 'string') { setTextContent(domElement, value); - } else if ( - typeof value === 'number' || - (enableBigIntSupport && typeof value === 'bigint') - ) { + } else if (typeof value === 'number' || typeof value === 'bigint') { // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint setTextContent(domElement, '' + value); } @@ -2948,7 +2941,7 @@ export function hydrateProperties( if ( typeof children === 'string' || typeof children === 'number' || - (enableBigIntSupport && typeof children === 'bigint') + typeof children === 'bigint' ) { if ( // $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint diff --git a/packages/react-dom-bindings/src/client/ReactDOMOption.js b/packages/react-dom-bindings/src/client/ReactDOMOption.js index 10d04bd6f7eb..ae7a7ba999c0 100644 --- a/packages/react-dom-bindings/src/client/ReactDOMOption.js +++ b/packages/react-dom-bindings/src/client/ReactDOMOption.js @@ -8,7 +8,6 @@ */ import {Children} from 'react'; -import {enableBigIntSupport} from 'shared/ReactFeatureFlags'; let didWarnSelectedSetOnOption = false; let didWarnInvalidChild = false; @@ -30,7 +29,7 @@ export function validateOptionProps(element: Element, props: Object) { if ( typeof child === 'string' || typeof child === 'number' || - (enableBigIntSupport && typeof child === 'bigint') + typeof child === 'bigint' ) { return; } diff --git a/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js b/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js index d67571fc41e1..9b9f41a92d37 100644 --- a/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js +++ b/packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js @@ -84,7 +84,6 @@ import { import {retryIfBlockedOn} from '../events/ReactDOMEventReplaying'; import { - enableBigIntSupport, enableCreateEventHandleAPI, enableScopeAPI, enableTrustedTypesIntegration, @@ -546,7 +545,7 @@ export function shouldSetTextContent(type: string, props: Props): boolean { type === 'noscript' || typeof props.children === 'string' || typeof props.children === 'number' || - (enableBigIntSupport && typeof props.children === 'bigint') || + typeof props.children === 'bigint' || (typeof props.dangerouslySetInnerHTML === 'object' && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null) diff --git a/packages/react-dom-bindings/src/client/ToStringValue.js b/packages/react-dom-bindings/src/client/ToStringValue.js index e1fc51b775dd..46708f2f7695 100644 --- a/packages/react-dom-bindings/src/client/ToStringValue.js +++ b/packages/react-dom-bindings/src/client/ToStringValue.js @@ -8,7 +8,6 @@ */ import {checkFormFieldValueStringCoercion} from 'shared/CheckStringCoercion'; -import {enableBigIntSupport} from 'shared/ReactFeatureFlags'; export opaque type ToStringValue = | boolean @@ -31,11 +30,6 @@ export function toString(value: ToStringValue): string { export function getToStringValue(value: mixed): ToStringValue { switch (typeof value) { case 'bigint': - if (!enableBigIntSupport) { - // bigint is assigned as empty string - return ''; - } - // fallthrough for BigInt support case 'boolean': case 'number': case 'string': diff --git a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js index 623bedd92e6e..475e934a6049 100644 --- a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js +++ b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js @@ -28,7 +28,6 @@ import { import {Children} from 'react'; import { - enableBigIntSupport, enableFilterEmptyStringAttributesDOM, enableFizzExternalRuntime, } from 'shared/ReactFeatureFlags'; @@ -1664,8 +1663,7 @@ function flattenOptionChildren(children: mixed): string { !didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number' && - ((enableBigIntSupport && typeof child !== 'bigint') || - !enableBigIntSupport) + typeof child !== 'bigint' ) { didWarnInvalidOptionChildren = true; console.error( @@ -2983,40 +2981,36 @@ function pushTitle( if (Array.isArray(children) && children.length > 1) { console.error( - 'React expects the `children` prop of tags to be a string, number%s, or object with a novel `toString` method but found an Array with length %s instead.' + + 'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an Array with length %s instead.' + ' Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert `children` of <title> tags to a single string value' + ' which is why Arrays of length greater than 1 are not supported. When using JSX it can be commong to combine text nodes and value nodes.' + ' For example: <title>hello {nameOfUser}. While not immediately apparent, `children` in this case is an Array with length 2. If your `children` prop' + ' is using this form try rewriting it using a template string: {`hello ${nameOfUser}`}.', - enableBigIntSupport ? ', bigint' : '', children.length, ); } else if (typeof child === 'function' || typeof child === 'symbol') { const childType = typeof child === 'function' ? 'a Function' : 'a Sybmol'; console.error( - 'React expect children of tags to be a string, number%s, or object with a novel `toString` method but found %s instead.' + + 'React expect children of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found %s instead.' + ' Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert children of <title>' + ' tags to a single string value.', - enableBigIntSupport ? ', bigint' : '', childType, ); } else if (child && child.toString === {}.toString) { if (child.$$typeof != null) { console.error( - 'React expects the `children` prop of <title> tags to be a string, number%s, or object with a novel `toString` method but found an object that appears to be' + + 'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an object that appears to be' + ' a React element which never implements a suitable `toString` method. Browsers treat all child Nodes of <title> tags as Text content and React expects to' + ' be able to convert children of <title> tags to a single string value which is why rendering React elements is not supported. If the `children` of <title> is' + ' a React Component try moving the <title> tag into that component. If the `children` of <title> is some HTML markup change it to be Text only to be valid HTML.', - enableBigIntSupport ? ', bigint' : '', ); } else { console.error( - 'React expects the `children` prop of <title> tags to be a string, number%s, or object with a novel `toString` method but found an object that does not implement' + + 'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an object that does not implement' + ' a suitable `toString` method. Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert children of <title> tags' + ' to a single string value. Using the default `toString` method available on every object is almost certainly an error. Consider whether the `children` of this <title>' + ' is an object in error and change it to a string or number value if so. Otherwise implement a `toString` method that React can use to produce a valid <title>.', - enableBigIntSupport ? ', bigint' : '', ); } } diff --git a/packages/react-dom-bindings/src/server/escapeTextForBrowser.js b/packages/react-dom-bindings/src/server/escapeTextForBrowser.js index 6fd43c01c5f6..4514bf66831d 100644 --- a/packages/react-dom-bindings/src/server/escapeTextForBrowser.js +++ b/packages/react-dom-bindings/src/server/escapeTextForBrowser.js @@ -39,7 +39,6 @@ */ import {checkHtmlStringCoercion} from 'shared/CheckStringCoercion'; -import {enableBigIntSupport} from 'shared/ReactFeatureFlags'; const matchHtmlRegExp = /["'&<>]/; @@ -110,7 +109,7 @@ function escapeTextForBrowser(text: string | number | boolean): string { if ( typeof text === 'boolean' || typeof text === 'number' || - (enableBigIntSupport && typeof text === 'bigint') + typeof text === 'bigint' ) { // this shortcircuit helps perf for types that we know will never have // special characters, especially given that this function is used often diff --git a/packages/react-dom/src/__tests__/ReactDOMFiber-test.js b/packages/react-dom/src/__tests__/ReactDOMFiber-test.js index f135bd288d19..a1633fa1e625 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFiber-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFiber-test.js @@ -60,7 +60,6 @@ describe('ReactDOMFiber', () => { expect(container.textContent).toEqual('10'); }); - // @gate enableBigIntSupport it('should render bigints as children', async () => { const Box = ({value}) => <div>{value}</div>; diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js index 2949443871c6..6064ad9312e8 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js @@ -3377,7 +3377,6 @@ describe('ReactDOMFizzServer', () => { ); }); - // @gate enableBigIntSupport it('Supports bigint', async () => { await act(async () => { const {pipe} = ReactDOMFizzServer.renderToPipeableStream( @@ -5732,9 +5731,7 @@ describe('ReactDOMFizzServer', () => { pipe(writable); }); }).toErrorDev([ - 'React expects the `children` prop of <title> tags to be a string, number' + - gate(flags => (flags.enableBigIntSupport ? ', bigint' : '')) + - ', or object with a novel `toString` method but found an Array with length 2 instead. Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert `children` of <title> tags to a single string value which is why Arrays of length greater than 1 are not supported. When using JSX it can be commong to combine text nodes and value nodes. For example: <title>hello {nameOfUser}. While not immediately apparent, `children` in this case is an Array with length 2. If your `children` prop is using this form try rewriting it using a template string: {`hello ${nameOfUser}`}.', + 'React expects the `children` prop of tags to be a string, number, bigint, or object with a novel `toString` method but found an Array with length 2 instead. Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert `children` of <title> tags to a single string value which is why Arrays of length greater than 1 are not supported. When using JSX it can be commong to combine text nodes and value nodes. For example: <title>hello {nameOfUser}. While not immediately apparent, `children` in this case is an Array with length 2. If your `children` prop is using this form try rewriting it using a template string: {`hello ${nameOfUser}`}.', ]); expect(getVisibleChildren(document.head)).toEqual(); @@ -5771,9 +5768,7 @@ describe('ReactDOMFizzServer', () => { pipe(writable); }); }).toErrorDev([ - 'React expects the `children` prop of <title> tags to be a string, number' + - gate(flags => (flags.enableBigIntSupport ? ', bigint' : '')) + - ', or object with a novel `toString` method but found an object that appears to be a React element which never implements a suitable `toString` method. Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert children of <title> tags to a single string value which is why rendering React elements is not supported. If the `children` of <title> is a React Component try moving the <title> tag into that component. If the `children` of <title> is some HTML markup change it to be Text only to be valid HTML.', + 'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an object that appears to be a React element which never implements a suitable `toString` method. Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert children of <title> tags to a single string value which is why rendering React elements is not supported. If the `children` of <title> is a React Component try moving the <title> tag into that component. If the `children` of <title> is some HTML markup change it to be Text only to be valid HTML.', ]); // object titles are toStringed when float is on expect(getVisibleChildren(document.head)).toEqual( @@ -5808,9 +5803,7 @@ describe('ReactDOMFizzServer', () => { pipe(writable); }); }).toErrorDev([ - 'React expects the `children` prop of <title> tags to be a string, number' + - gate(flags => (flags.enableBigIntSupport ? ', bigint' : '')) + - ', or object with a novel `toString` method but found an object that does not implement a suitable `toString` method. Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert children of <title> tags to a single string value. Using the default `toString` method available on every object is almost certainly an error. Consider whether the `children` of this <title> is an object in error and change it to a string or number value if so. Otherwise implement a `toString` method that React can use to produce a valid <title>.', + 'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an object that does not implement a suitable `toString` method. Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert children of <title> tags to a single string value. Using the default `toString` method available on every object is almost certainly an error. Consider whether the `children` of this <title> is an object in error and change it to a string or number value if so. Otherwise implement a `toString` method that React can use to produce a valid <title>.', ]); // object titles are toStringed when float is on expect(getVisibleChildren(document.head)).toEqual( diff --git a/packages/react-dom/src/__tests__/ReactDOMInput-test.js b/packages/react-dom/src/__tests__/ReactDOMInput-test.js index f817ede5214c..8b0dd3274d71 100644 --- a/packages/react-dom/src/__tests__/ReactDOMInput-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMInput-test.js @@ -846,7 +846,6 @@ describe('ReactDOMInput', () => { expect(node.value).toBe('0'); }); - // @gate enableBigIntSupport it('should display `value` of bigint 5', async () => { await act(() => { root.render(<input type="text" value={5n} onChange={emptyFunction} />); diff --git a/packages/react-dom/src/__tests__/ReactDOMOption-test.js b/packages/react-dom/src/__tests__/ReactDOMOption-test.js index 8743c5993ddb..1661a98b1a69 100644 --- a/packages/react-dom/src/__tests__/ReactDOMOption-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMOption-test.js @@ -171,7 +171,6 @@ describe('ReactDOMOption', () => { expect(container.firstChild.value).toBe('hello'); }); - // @gate enableBigIntSupport it('should support bigint values', async () => { const container = await renderIntoDocument(<option>{5n}</option>); expect(container.firstChild.innerHTML).toBe('5'); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js index 266bae3d5eea..6323fe9b60c0 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js @@ -74,12 +74,8 @@ describe('ReactDOMServerIntegration', () => { itRenders('a bigint', async render => { const e = await render(42n); - if (gate(flags => flags.enableBigIntSupport)) { - expect(e.nodeType).toBe(3); - expect(e.nodeValue).toMatch('42'); - } else { - expect(e).toBe(null); - } + expect(e.nodeType).toBe(3); + expect(e.nodeValue).toMatch('42'); }); itRenders('an array with one child', async render => { diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationInput-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationInput-test.js index 9f16ed58a761..7066aea04baf 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationInput-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationInput-test.js @@ -32,8 +32,7 @@ function initModules() { }; } -const {resetModules, itRenders, serverRender, streamRender} = - ReactDOMServerIntegrationUtils(initModules); +const {resetModules, itRenders} = ReactDOMServerIntegrationUtils(initModules); // TODO: Run this in React Fire mode after we figure out the SSR behavior. const desc = disableInputAttributeSyncing ? xdescribe : describe; @@ -49,13 +48,7 @@ desc('ReactDOMServerIntegrationInput', () => { itRenders('an input with a bigint value and an onChange', async render => { const e = await render(<input value={5n} onChange={() => {}} />); - expect(e.value).toBe( - gate(flags => flags.enableBigIntSupport) || - render === serverRender || - render === streamRender - ? '5' - : '', - ); + expect(e.value).toBe('5'); }); itRenders('an input with a value and readOnly', async render => { diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSelect-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSelect-test.js index 9b20b1edcd21..664914a43668 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSelect-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSelect-test.js @@ -224,9 +224,7 @@ describe('ReactDOMServerIntegrationSelect', () => { </select>, ); const option = e.options[0]; - expect(option.textContent).toBe( - gate(flags => flags.enableBigIntSupport) ? 'A B 5' : 'A B ', - ); + expect(option.textContent).toBe('A B 5'); expect(option.value).toBe('bar'); expect(option.selected).toBe(true); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationTextarea-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationTextarea-test.js index 79b5fd840d88..9ce04840dbb0 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationTextarea-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationTextarea-test.js @@ -30,8 +30,7 @@ function initModules() { }; } -const {resetModules, itRenders, serverRender, streamRender} = - ReactDOMServerIntegrationUtils(initModules); +const {resetModules, itRenders} = ReactDOMServerIntegrationUtils(initModules); describe('ReactDOMServerIntegrationTextarea', () => { beforeEach(() => { @@ -51,13 +50,7 @@ describe('ReactDOMServerIntegrationTextarea', () => { itRenders('a textarea with a bigint value and an onChange', async render => { const e = await render(<textarea value={5n} onChange={() => {}} />); expect(e.getAttribute('value')).toBe(null); - expect(e.value).toBe( - gate(flags => flags.enableBigIntSupport) || - render === serverRender || - render === streamRender - ? '5' - : '', - ); + expect(e.value).toBe('5'); }); itRenders('a textarea with a value of undefined', async render => { diff --git a/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js b/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js index 134e019c6b65..db7cb1bf6268 100644 --- a/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMTextarea-test.js @@ -80,7 +80,6 @@ describe('ReactDOMTextarea', () => { expect(node.value).toBe('0'); }); - // @gate enableBigIntSupport it('should display `defaultValue` of bigint 0', async () => { const container = document.createElement('div'); const root = ReactDOMClient.createRoot(container); diff --git a/packages/react-dom/src/__tests__/ReactMultiChildText-test.js b/packages/react-dom/src/__tests__/ReactMultiChildText-test.js index 7cf2c048c504..c9c45e2d0ed0 100644 --- a/packages/react-dom/src/__tests__/ReactMultiChildText-test.js +++ b/packages/react-dom/src/__tests__/ReactMultiChildText-test.js @@ -174,7 +174,6 @@ describe('ReactMultiChildText', () => { ]); }); - // @gate enableBigIntSupport it('should correctly handle bigint children for render and update', async () => { // prettier-ignore await testAllPermutations([ diff --git a/packages/react-reconciler/src/ReactChildFiber.js b/packages/react-reconciler/src/ReactChildFiber.js index 956af89af076..dde892c5893e 100644 --- a/packages/react-reconciler/src/ReactChildFiber.js +++ b/packages/react-reconciler/src/ReactChildFiber.js @@ -25,7 +25,6 @@ import { Forked, PlacementDEV, } from './ReactFiberFlags'; -import {enableBigIntSupport} from 'shared/ReactFeatureFlags'; import { getIteratorFn, REACT_ELEMENT_TYPE, @@ -658,7 +657,7 @@ function createChildReconciler( if ( (typeof newChild === 'string' && newChild !== '') || typeof newChild === 'number' || - (enableBigIntSupport && typeof newChild === 'bigint') + typeof newChild === 'bigint' ) { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text @@ -780,7 +779,7 @@ function createChildReconciler( if ( (typeof newChild === 'string' && newChild !== '') || typeof newChild === 'number' || - (enableBigIntSupport && typeof newChild === 'bigint') + typeof newChild === 'bigint' ) { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text @@ -905,7 +904,7 @@ function createChildReconciler( if ( (typeof newChild === 'string' && newChild !== '') || typeof newChild === 'number' || - (enableBigIntSupport && typeof newChild === 'bigint') + typeof newChild === 'bigint' ) { // Text nodes don't have keys, so we neither have to check the old nor // new node for the key. If both are text nodes, they match. @@ -1722,7 +1721,7 @@ function createChildReconciler( if ( (typeof newChild === 'string' && newChild !== '') || typeof newChild === 'number' || - (enableBigIntSupport && typeof newChild === 'bigint') + typeof newChild === 'bigint' ) { return placeSingleChild( reconcileSingleTextNode( diff --git a/packages/react-reconciler/src/__tests__/ReactTopLevelText-test.js b/packages/react-reconciler/src/__tests__/ReactTopLevelText-test.js index 9c5de7bd2ee5..b1d8dd5e0108 100644 --- a/packages/react-reconciler/src/__tests__/ReactTopLevelText-test.js +++ b/packages/react-reconciler/src/__tests__/ReactTopLevelText-test.js @@ -40,7 +40,6 @@ describe('ReactTopLevelText', () => { expect(ReactNoop).toMatchRenderedOutput('10'); }); - // @gate enableBigIntSupport it('should render a component returning bigints directly from render', async () => { const Text = ({value}) => value; ReactNoop.render(<Text value={10n} />); diff --git a/packages/react-server/src/ReactFizzServer.js b/packages/react-server/src/ReactFizzServer.js index a06ef06e8bb2..7d5659981e40 100644 --- a/packages/react-server/src/ReactFizzServer.js +++ b/packages/react-server/src/ReactFizzServer.js @@ -137,7 +137,6 @@ import { import ReactSharedInternals from 'shared/ReactSharedInternals'; import { disableLegacyContext, - enableBigIntSupport, enableScopeAPI, enableSuspenseAvoidThisFallbackFizz, enableCache, @@ -2323,10 +2322,7 @@ function renderNodeDestructive( return; } - if ( - typeof node === 'number' || - (enableBigIntSupport && typeof node === 'bigint') - ) { + if (typeof node === 'number' || typeof node === 'bigint') { const segment = task.blockedSegment; if (segment === null) { // We assume a text node doesn't have a representation in the replay set, diff --git a/packages/react/src/ReactChildren.js b/packages/react/src/ReactChildren.js index d3c155dc8be7..d671c1503327 100644 --- a/packages/react/src/ReactChildren.js +++ b/packages/react/src/ReactChildren.js @@ -16,7 +16,6 @@ import type { } from 'shared/ReactTypes'; import isArray from 'shared/isArray'; -import {enableBigIntSupport} from 'shared/ReactFeatureFlags'; import { getIteratorFn, REACT_ELEMENT_TYPE, @@ -165,10 +164,6 @@ function mapIntoArray( } else { switch (type) { case 'bigint': - if (!enableBigIntSupport) { - break; - } - // fallthrough for enabled BigInt support case 'string': case 'number': invokeCallback = true; diff --git a/packages/react/src/__tests__/ReactChildren-test.js b/packages/react/src/__tests__/ReactChildren-test.js index 062794d31691..92e7ba435a1d 100644 --- a/packages/react/src/__tests__/ReactChildren-test.js +++ b/packages/react/src/__tests__/ReactChildren-test.js @@ -188,9 +188,7 @@ describe('ReactChildren', () => { ); function assertCalls() { - expect(callback).toHaveBeenCalledTimes( - gate(flags => flags.enableBigIntSupport) ? 10 : 9, - ); + expect(callback).toHaveBeenCalledTimes(10); expect(callback).toHaveBeenCalledWith(div, 0); expect(callback).toHaveBeenCalledWith(span, 1); expect(callback).toHaveBeenCalledWith(a, 2); @@ -200,11 +198,7 @@ describe('ReactChildren', () => { expect(callback).toHaveBeenCalledWith(null, 6); expect(callback).toHaveBeenCalledWith(null, 7); expect(callback).toHaveBeenCalledWith(null, 8); - if (gate(flags => flags.enableBigIntSupport)) { - expect(callback).toHaveBeenCalledWith(9n, 9); - } else { - expect(callback).not.toHaveBeenCalledWith(9n, 9); - } + expect(callback).toHaveBeenCalledWith(9n, 9); callback.mockClear(); } @@ -217,24 +211,14 @@ describe('ReactChildren', () => { context, ); assertCalls(); - expect(mappedChildren).toEqual( - gate(flags => flags.enableBigIntSupport) - ? [ - <div key=".$divNode" />, - <span key=".1:0:$spanNode" />, - <a key=".2:$aNode" />, - 'string', - 1234, - 9n, - ] - : [ - <div key=".$divNode" />, - <span key=".1:0:$spanNode" />, - <a key=".2:$aNode" />, - 'string', - 1234, - ], - ); + expect(mappedChildren).toEqual([ + <div key=".$divNode" />, + <span key=".1:0:$spanNode" />, + <a key=".2:$aNode" />, + 'string', + 1234, + 9n, + ]); }); it('should be called for each child in nested structure', () => { diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 5100868b96aa..a55e86480645 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -161,8 +161,6 @@ export const disableClientCache = false; // Changes Server Components Reconciliation when they have keys export const enableServerComponentKeys = true; -export const enableBigIntSupport = true; - /** * Enables a new error detection for infinite render loops from updates caused * by setState or similar outside of the component owning the state. diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js b/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js index be82df80b821..2dfb0f2bd2a0 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js @@ -20,7 +20,6 @@ export const alwaysThrottleRetries = __VARIANT__; export const consoleManagedByDevToolsDuringStrictMode = __VARIANT__; export const enableAsyncActions = __VARIANT__; -export const enableBigIntSupport = __VARIANT__; export const enableComponentStackLocations = __VARIANT__; export const enableDeferRootSchedulingToMicrotask = __VARIANT__; export const enableInfiniteRenderLoopDetection = __VARIANT__; diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index 1a5636531feb..62b554010caa 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -22,7 +22,6 @@ export const { alwaysThrottleRetries, consoleManagedByDevToolsDuringStrictMode, enableAsyncActions, - enableBigIntSupport, enableComponentStackLocations, enableDeferRootSchedulingToMicrotask, enableInfiniteRenderLoopDetection, diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index 4287a6afba3e..f89969af59b9 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -22,7 +22,6 @@ export const enableRefAsProp = __TODO_NEXT_RN_MAJOR__; export const disableStringRefs = __TODO_NEXT_RN_MAJOR__; export const disableLegacyMode = __TODO_NEXT_RN_MAJOR__; export const disableDOMTestUtils = __TODO_NEXT_RN_MAJOR__; -export const enableBigIntSupport = __TODO_NEXT_RN_MAJOR__; export const useModernStrictMode = __TODO_NEXT_RN_MAJOR__; export const enableReactTestRendererWarning = __TODO_NEXT_RN_MAJOR__; export const enableAsyncActions = __TODO_NEXT_RN_MAJOR__; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index 2c3db195ac7d..f93977ed1925 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -87,7 +87,6 @@ export const enableInfiniteRenderLoopDetection = false; // const __NEXT_MAJOR__ = __EXPERIMENTAL__; export const enableRefAsProp = true; export const disableStringRefs = true; -export const enableBigIntSupport = true; export const disableLegacyMode = true; export const disableLegacyContext = true; export const disableDOMTestUtils = true; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js index 4a860268d035..2b85343516ab 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js @@ -86,7 +86,5 @@ export const enableReactTestRendererWarning = false; export const disableLegacyMode = false; export const disableDOMTestUtils = false; -export const enableBigIntSupport = false; - // Flow magic to verify the exports of this file match the original version. ((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index 9f95dacd7ab6..9a757423fe7d 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -87,7 +87,5 @@ export const enableReactTestRendererWarning = false; export const disableLegacyMode = false; export const disableDOMTestUtils = false; -export const enableBigIntSupport = true; - // Flow magic to verify the exports of this file match the original version. ((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js index 552a588ad64f..96921a847d93 100644 --- a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js +++ b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js @@ -14,7 +14,6 @@ // with the __VARIANT__ set to `true`, and once set to `false`. export const disableIEWorkarounds = __VARIANT__; -export const enableBigIntSupport = __VARIANT__; export const enableUseRefAccessWarning = __VARIANT__; export const disableSchedulerTimeoutInWorkLoop = __VARIANT__; export const enableLazyContextPropagation = __VARIANT__; diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index ef7a207974cf..39fcd219eae3 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -16,7 +16,6 @@ const dynamicFeatureFlags: DynamicFeatureFlags = require('ReactFeatureFlags'); export const { disableIEWorkarounds, - enableBigIntSupport, enableTrustedTypesIntegration, enableDebugTracing, enableUseRefAccessWarning,