From 4a3ab5303d23ac1684f7d71a869a54fb1ef6e00e Mon Sep 17 00:00:00 2001 From: Jack Pope Date: Tue, 12 Mar 2024 11:32:40 -0400 Subject: [PATCH 1/2] Rename isConcurrent RTR option back to unstable --- .../ReactHooksInspectionIntegration-test.js | 2 +- .../src/__tests__/inspectedElement-test.js | 14 +++--- ...rorBoundaryReconciliation-test.internal.js | 2 +- .../src/__tests__/ReactHooks-test.internal.js | 16 +++--- .../src/__tests__/ReactLazy-test.internal.js | 50 +++++++++---------- .../__tests__/ReactTestRendererAsync-test.js | 8 +-- ...ofilerDevToolsIntegration-test.internal.js | 2 +- .../__tests__/ReactStartTransition-test.js | 2 +- 8 files changed, 48 insertions(+), 48 deletions(-) diff --git a/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js b/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js index 97110f682d572..5b56bd8a8de9e 100644 --- a/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js +++ b/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js @@ -1012,7 +1012,7 @@ describe('ReactHooksInspectionIntegration', () => { ); } const renderer = await act(() => { - return ReactTestRenderer.create(, {isConcurrent: true}); + return ReactTestRenderer.create(, {unstable_isConcurrent: true}); }); expect(renderer).toMatchRenderedOutput(null); let childFiber = renderer.root.findByType(Foo)._currentFiber(); diff --git a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js index a0174338c7a4b..d579db1bdd639 100644 --- a/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js +++ b/packages/react-devtools-shared/src/__tests__/inspectedElement-test.js @@ -77,7 +77,7 @@ describe('InspectedElement', () => { // Used by inspectElementAtIndex() helper function utils.act(() => { testRendererInstance = TestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); }); @@ -356,7 +356,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); }, ); @@ -510,7 +510,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); }, ); @@ -2069,7 +2069,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); }, ); @@ -2129,7 +2129,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); }, ); @@ -2405,7 +2405,7 @@ describe('InspectedElement', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ); }, false); await utils.actAsync(() => { @@ -2943,7 +2943,7 @@ describe('InspectedElement', () => { ['An update to %s inside a test was not wrapped in act'], () => { testRendererInstance = TestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); }, ); diff --git a/packages/react-reconciler/src/__tests__/ErrorBoundaryReconciliation-test.internal.js b/packages/react-reconciler/src/__tests__/ErrorBoundaryReconciliation-test.internal.js index 0ce51699849b7..71e047afc5ff6 100644 --- a/packages/react-reconciler/src/__tests__/ErrorBoundaryReconciliation-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ErrorBoundaryReconciliation-test.internal.js @@ -59,7 +59,7 @@ describe('ErrorBoundaryReconciliation', () => { , - {isConcurrent: isConcurrent}, + {unstable_isConcurrent: isConcurrent}, ); }); expect(renderer).toMatchRenderedOutput(); diff --git a/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js b/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js index a23b904d42c7c..d3b27b708e06a 100644 --- a/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js @@ -86,7 +86,7 @@ describe('ReactHooks', () => { return ; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Parent: 0, 0', 'Child: 0, 0', 'Effect: 0, 0']); expect(root).toMatchRenderedOutput('0, 0'); @@ -174,7 +174,7 @@ describe('ReactHooks', () => { Parent = memo(Parent); - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Parent: 0, 0 (light)', 'Child: 0, 0 (light)']); expect(root).toMatchRenderedOutput('0, 0 (light)'); @@ -232,7 +232,7 @@ describe('ReactHooks', () => { return counter; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Count: 0']); expect(root).toMatchRenderedOutput('0'); @@ -266,7 +266,7 @@ describe('ReactHooks', () => { return counter; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Count: 0']); expect(root).toMatchRenderedOutput('0'); @@ -322,7 +322,7 @@ describe('ReactHooks', () => { }); return ; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); await act(() => { root.update( @@ -390,7 +390,7 @@ describe('ReactHooks', () => { return ; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Parent: 0', 'Child: 0', 'Effect: 0']); expect(root).toMatchRenderedOutput('0'); @@ -465,7 +465,7 @@ describe('ReactHooks', () => { return ; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Parent: 0', 'Child: 0']); expect(root).toMatchRenderedOutput('0'); @@ -523,7 +523,7 @@ describe('ReactHooks', () => { return ; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); root.update(); await waitForAll(['Parent: 1', 'Child: 1']); expect(root).toMatchRenderedOutput('1'); diff --git a/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js b/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js index 082d922acfb3f..1c0fafd29035e 100644 --- a/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js @@ -97,7 +97,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -183,7 +183,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -206,7 +206,7 @@ describe('ReactLazy', () => { const LazyText = lazy(async () => Text); const root = ReactTestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); let error; @@ -240,7 +240,7 @@ describe('ReactLazy', () => { }); const root = ReactTestRenderer.create(null, { - isConcurrent: true, + unstable_isConcurrent: true, }); let error; @@ -300,7 +300,7 @@ describe('ReactLazy', () => { } const root = ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); await waitForAll(['Suspend! [LazyChildA]', 'Loading...']); @@ -335,7 +335,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -392,7 +392,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); await waitForAll(['Loading...']); @@ -438,7 +438,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); await waitForAll(['Not lazy: 0', 'Loading...']); @@ -483,7 +483,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); await waitForAll(['Not lazy: 0', 'Loading...']); @@ -559,7 +559,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -689,7 +689,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -732,7 +732,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -759,7 +759,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -792,7 +792,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -939,7 +939,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -977,7 +977,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -1022,7 +1022,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -1053,7 +1053,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); await waitForAll(['Loading...']); @@ -1140,7 +1140,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); await waitForAll(['Loading...']); @@ -1187,7 +1187,7 @@ describe('ReactLazy', () => { , { - isConcurrent: true, + unstable_isConcurrent: true, }, ); @@ -1227,7 +1227,7 @@ describe('ReactLazy', () => { , - {isConcurrent: true}, + {unstable_isConcurrent: true}, ); await waitForAll(['Loading...']); @@ -1335,7 +1335,7 @@ describe('ReactLazy', () => { } const root = ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); await waitForAll(['Init A', 'Loading...']); @@ -1420,7 +1420,7 @@ describe('ReactLazy', () => { } const root = ReactTestRenderer.create(, { - isConcurrent: false, + unstable_isConcurrent: false, }); assertLog(['Init A', 'Init B', 'Loading...']); @@ -1482,7 +1482,7 @@ describe('ReactLazy', () => { } const root = ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); await waitForAll(['Init A', 'Loading...']); @@ -1551,7 +1551,7 @@ describe('ReactLazy', () => { } const root = ReactTestRenderer.create(, { - isConcurrent: false, + unstable_isConcurrent: false, }); assertLog(['Init A', 'Loading...']); diff --git a/packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js b/packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js index 51c7e0a950ddc..468f62d39a722 100644 --- a/packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js +++ b/packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js @@ -34,7 +34,7 @@ describe('ReactTestRendererAsync', () => { return props.children; } const renderer = ReactTestRenderer.create(Hi, { - isConcurrent: true, + unstable_isConcurrent: true, }); // Before flushing, nothing has mounted. @@ -68,7 +68,7 @@ describe('ReactTestRendererAsync', () => { ); } const renderer = ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); await waitForAll(['A:1', 'B:1', 'C:1']); @@ -97,7 +97,7 @@ describe('ReactTestRendererAsync', () => { let renderer; React.startTransition(() => { renderer = ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); }); @@ -137,7 +137,7 @@ describe('ReactTestRendererAsync', () => { let renderer; React.startTransition(() => { renderer = ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); }); diff --git a/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js b/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js index 20263f9058645..2f28d2b60d43b 100644 --- a/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js +++ b/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js @@ -154,7 +154,7 @@ describe('ReactProfiler DevTools integration', () => { return text; } - const root = ReactTestRenderer.create(null, {isConcurrent: true}); + const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true}); // Commit something root.update(); diff --git a/packages/react/src/__tests__/ReactStartTransition-test.js b/packages/react/src/__tests__/ReactStartTransition-test.js index c98372a7c74b7..9e689ac6e7105 100644 --- a/packages/react/src/__tests__/ReactStartTransition-test.js +++ b/packages/react/src/__tests__/ReactStartTransition-test.js @@ -49,7 +49,7 @@ describe('ReactStartTransition', () => { await act(() => { ReactTestRenderer.create(, { - isConcurrent: true, + unstable_isConcurrent: true, }); }); From 2a36964b04a7a4fe69ac7577b4d1724da35d7a5a Mon Sep 17 00:00:00 2001 From: Jack Pope Date: Wed, 13 Mar 2024 10:41:34 -0400 Subject: [PATCH 2/2] Remove option --- packages/react-test-renderer/src/ReactTestRenderer.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/react-test-renderer/src/ReactTestRenderer.js b/packages/react-test-renderer/src/ReactTestRenderer.js index d0494de7293ed..57b6f4d8b4f47 100644 --- a/packages/react-test-renderer/src/ReactTestRenderer.js +++ b/packages/react-test-renderer/src/ReactTestRenderer.js @@ -63,7 +63,6 @@ const act = React.act; type TestRendererOptions = { createNodeMock: (element: React$Element) => any, - isConcurrent: boolean, unstable_isConcurrent: boolean, unstable_strictMode: boolean, unstable_concurrentUpdatesByDefault: boolean, @@ -491,10 +490,7 @@ function create( // $FlowFixMe[incompatible-type] found when upgrading Flow createNodeMock = options.createNodeMock; } - if ( - options.unstable_isConcurrent === true || - options.isConcurrent === true - ) { + if (options.unstable_isConcurrent === true) { isConcurrent = true; } if (options.unstable_strictMode === true) {