Update isConcurrent RTR option usage (#28546)
Reverting some of https://github.com/facebook/react/pull/27804 which renamed this option to stable. This PR just replaces internal usage to make upcoming PRs cleaner. Keeping isConcurrent unstable for the next major release in order to enable a broader deprecation of RTR and be consistent with concurrent rendering everywhere for next major. (https://github.com/facebook/react/pull/28498) - Next major will use concurrent root - The old behavior (legacy root by default, concurrent root with unstable option) will be preserved for React Native until new architecture is fully shipped. - Flag and legacy root usage can be removed after RN dependency is unblocked without an additional breaking change
Jack Pope committed
Mar 18, 2024 at 11:35 UTC
38327309a4172a52cf94e8e264990bedafc1df6e
9 files changed
+49
-53
packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js
+1
-1
@@ -1012,7 +1012,7 @@ describe('ReactHooksInspectionIntegration', () => {
1012
);
1013
}
1014
const renderer = await act(() => {
1015
- return ReactTestRenderer.create(<Foo />, {isConcurrent: true});
1015
+ return ReactTestRenderer.create(<Foo />, {unstable_isConcurrent: true});
1016
});
1017
expect(renderer).toMatchRenderedOutput(null);
1018
let childFiber = renderer.root.findByType(Foo)._currentFiber();
packages/react-devtools-shared/src/__tests__/inspectedElement-test.js
+7
-7
@@ -77,7 +77,7 @@ describe('InspectedElement', () => {
77
// Used by inspectElementAtIndex() helper function
78
utils.act(() => {
79
testRendererInstance = TestRenderer.create(null, {
80
- isConcurrent: true,
80
+ unstable_isConcurrent: true,
81
});
82
});
83
@@ -356,7 +356,7 @@ describe('InspectedElement', () => {
356
['An update to %s inside a test was not wrapped in act'],
357
() => {
358
testRendererInstance = TestRenderer.create(null, {
359
- isConcurrent: true,
359
+ unstable_isConcurrent: true,
360
});
361
},
362
);
@@ -510,7 +510,7 @@ describe('InspectedElement', () => {
510
['An update to %s inside a test was not wrapped in act'],
511
() => {
512
testRendererInstance = TestRenderer.create(null, {
513
- isConcurrent: true,
513
+ unstable_isConcurrent: true,
514
});
515
},
516
);
@@ -2069,7 +2069,7 @@ describe('InspectedElement', () => {
2069
['An update to %s inside a test was not wrapped in act'],
2070
() => {
2071
testRendererInstance = TestRenderer.create(null, {
2072
- isConcurrent: true,
2072
+ unstable_isConcurrent: true,
2073
});
2074
},
2075
);
@@ -2129,7 +2129,7 @@ describe('InspectedElement', () => {
2129
['An update to %s inside a test was not wrapped in act'],
2130
() => {
2131
testRendererInstance = TestRenderer.create(null, {
2132
- isConcurrent: true,
2132
+ unstable_isConcurrent: true,
2133
});
2134
},
2135
);
@@ -2405,7 +2405,7 @@ describe('InspectedElement', () => {
2405
<Suspender target={id} />
2406
</React.Suspense>
2407
</Contexts>,
2408
- {isConcurrent: true},
2408
+ {unstable_isConcurrent: true},
2409
);
2410
}, false);
2411
await utils.actAsync(() => {
@@ -2943,7 +2943,7 @@ describe('InspectedElement', () => {
2943
['An update to %s inside a test was not wrapped in act'],
2944
() => {
2945
testRendererInstance = TestRenderer.create(null, {
2946
- isConcurrent: true,
2946
+ unstable_isConcurrent: true,
2947
});
2948
},
2949
);
packages/react-reconciler/src/__tests__/ErrorBoundaryReconciliation-test.internal.js
+1
-1
@@ -55,7 +55,7 @@ describe('ErrorBoundaryReconciliation', () => {
55
<ErrorBoundary fallbackTagName={fallbackTagName}>
56
<BrokenRender fail={false} />
57
</ErrorBoundary>,
58
- {isConcurrent: isConcurrent},
58
+ {unstable_isConcurrent: isConcurrent},
59
);
60
});
61
expect(renderer).toMatchRenderedOutput(<span prop="BrokenRender" />);
packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js
+8
-8
@@ -86,7 +86,7 @@ describe('ReactHooks', () => {
86
return <Child text={text} />;
87
}
88
89
- const root = ReactTestRenderer.create(null, {isConcurrent: true});
89
+ const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
90
root.update(<Parent />);
91
await waitForAll(['Parent: 0, 0', 'Child: 0, 0', 'Effect: 0, 0']);
92
expect(root).toMatchRenderedOutput('0, 0');
@@ -174,7 +174,7 @@ describe('ReactHooks', () => {
174
175
Parent = memo(Parent);
176
177
- const root = ReactTestRenderer.create(null, {isConcurrent: true});
177
+ const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
178
root.update(<Parent theme="light" />);
179
await waitForAll(['Parent: 0, 0 (light)', 'Child: 0, 0 (light)']);
180
expect(root).toMatchRenderedOutput('0, 0 (light)');
@@ -232,7 +232,7 @@ describe('ReactHooks', () => {
232
return counter;
233
}
234
235
- const root = ReactTestRenderer.create(null, {isConcurrent: true});
235
+ const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
236
root.update(<Counter />);
237
await waitForAll(['Count: 0']);
238
expect(root).toMatchRenderedOutput('0');
@@ -266,7 +266,7 @@ describe('ReactHooks', () => {
266
return counter;
267
}
268
269
- const root = ReactTestRenderer.create(null, {isConcurrent: true});
269
+ const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
270
root.update(<Counter />);
271
await waitForAll(['Count: 0']);
272
expect(root).toMatchRenderedOutput('0');
@@ -322,7 +322,7 @@ describe('ReactHooks', () => {
322
});
323
return <Child text={text} />;
324
}
325
- const root = ReactTestRenderer.create(null, {isConcurrent: true});
325
+ const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
326
await act(() => {
327
root.update(
328
<ThemeProvider>
@@ -390,7 +390,7 @@ describe('ReactHooks', () => {
390
return <Child text={counter} />;
391
}
392
393
- const root = ReactTestRenderer.create(null, {isConcurrent: true});
393
+ const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
394
root.update(<Parent />);
395
await waitForAll(['Parent: 0', 'Child: 0', 'Effect: 0']);
396
expect(root).toMatchRenderedOutput('0');
@@ -465,7 +465,7 @@ describe('ReactHooks', () => {
465
return <Child text={counter} />;
466
}
467
468
- const root = ReactTestRenderer.create(null, {isConcurrent: true});
468
+ const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
469
root.update(<Parent />);
470
await waitForAll(['Parent: 0', 'Child: 0']);
471
expect(root).toMatchRenderedOutput('0');
@@ -523,7 +523,7 @@ describe('ReactHooks', () => {
523
return <Child text={counter} />;
524
}
525
526
- const root = ReactTestRenderer.create(null, {isConcurrent: true});
526
+ const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
527
root.update(<Parent />);
528
await waitForAll(['Parent: 1', 'Child: 1']);
529
expect(root).toMatchRenderedOutput('1');
packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js
+25
-25
@@ -93,7 +93,7 @@ describe('ReactLazy', () => {
93
<LazyText text="Hi" />
94
</Suspense>,
95
{
96
- isConcurrent: true,
96
+ unstable_isConcurrent: true,
97
},
98
);
99
@@ -179,7 +179,7 @@ describe('ReactLazy', () => {
179
<LazyBar />
180
</Suspense>,
181
{
182
- isConcurrent: true,
182
+ unstable_isConcurrent: true,
183
},
184
);
185
@@ -202,7 +202,7 @@ describe('ReactLazy', () => {
202
const LazyText = lazy(async () => Text);
203
204
const root = ReactTestRenderer.create(null, {
205
- isConcurrent: true,
205
+ unstable_isConcurrent: true,
206
});
207
208
let error;
@@ -236,7 +236,7 @@ describe('ReactLazy', () => {
236
});
237
238
const root = ReactTestRenderer.create(null, {
239
- isConcurrent: true,
239
+ unstable_isConcurrent: true,
240
});
241
242
let error;
@@ -296,7 +296,7 @@ describe('ReactLazy', () => {
296
}
297
298
const root = ReactTestRenderer.create(<Parent swap={false} />, {
299
- isConcurrent: true,
299
+ unstable_isConcurrent: true,
300
});
301
302
await waitForAll(['Suspend! [LazyChildA]', 'Loading...']);
@@ -331,7 +331,7 @@ describe('ReactLazy', () => {
331
<LazyText />
332
</Suspense>,
333
{
334
- isConcurrent: true,
334
+ unstable_isConcurrent: true,
335
},
336
);
337
@@ -388,7 +388,7 @@ describe('ReactLazy', () => {
388
</Lazy>
389
</Suspense>,
390
{
391
- isConcurrent: true,
391
+ unstable_isConcurrent: true,
392
},
393
);
394
await waitForAll(['Loading...']);
@@ -434,7 +434,7 @@ describe('ReactLazy', () => {
434
</Suspense>
435
</>,
436
{
437
- isConcurrent: true,
437
+ unstable_isConcurrent: true,
438
},
439
);
440
await waitForAll(['Not lazy: 0', 'Loading...']);
@@ -479,7 +479,7 @@ describe('ReactLazy', () => {
479
</Suspense>
480
</>,
481
{
482
- isConcurrent: true,
482
+ unstable_isConcurrent: true,
483
},
484
);
485
await waitForAll(['Not lazy: 0', 'Loading...']);
@@ -555,7 +555,7 @@ describe('ReactLazy', () => {
555
<LazyClass num={1} />
556
</Suspense>,
557
{
558
- isConcurrent: true,
558
+ unstable_isConcurrent: true,
559
},
560
);
561
@@ -685,7 +685,7 @@ describe('ReactLazy', () => {
685
<LazyText />
686
</Suspense>,
687
{
688
- isConcurrent: true,
688
+ unstable_isConcurrent: true,
689
},
690
);
691
@@ -728,7 +728,7 @@ describe('ReactLazy', () => {
728
<BadLazy />
729
</Suspense>,
730
{
731
- isConcurrent: true,
731
+ unstable_isConcurrent: true,
732
},
733
);
734
@@ -755,7 +755,7 @@ describe('ReactLazy', () => {
755
<Lazy2 text="Hello" />
756
</Suspense>,
757
{
758
- isConcurrent: true,
758
+ unstable_isConcurrent: true,
759
},
760
);
761
@@ -788,7 +788,7 @@ describe('ReactLazy', () => {
788
<LazyAdd inner="2" outer="2" />
789
</Suspense>,
790
{
791
- isConcurrent: true,
791
+ unstable_isConcurrent: true,
792
},
793
);
794
@@ -935,7 +935,7 @@ describe('ReactLazy', () => {
935
<LazyText />
936
</Suspense>,
937
{
938
- isConcurrent: true,
938
+ unstable_isConcurrent: true,
939
},
940
);
941
@@ -973,7 +973,7 @@ describe('ReactLazy', () => {
973
<LazyFoo />
974
</Suspense>,
975
{
976
- isConcurrent: true,
976
+ unstable_isConcurrent: true,
977
},
978
);
979
@@ -1018,7 +1018,7 @@ describe('ReactLazy', () => {
1018
<LazyForwardRef ref={ref} />
1019
</Suspense>,
1020
{
1021
- isConcurrent: true,
1021
+ unstable_isConcurrent: true,
1022
},
1023
);
1024
@@ -1049,7 +1049,7 @@ describe('ReactLazy', () => {
1049
<LazyAdd outer={2} />
1050
</Suspense>,
1051
{
1052
- isConcurrent: true,
1052
+ unstable_isConcurrent: true,
1053
},
1054
);
1055
await waitForAll(['Loading...']);
@@ -1136,7 +1136,7 @@ describe('ReactLazy', () => {
1136
<LazyAdd outer={2} />
1137
</Suspense>,
1138
{
1139
- isConcurrent: true,
1139
+ unstable_isConcurrent: true,
1140
},
1141
);
1142
await waitForAll(['Loading...']);
@@ -1183,7 +1183,7 @@ describe('ReactLazy', () => {
1183
<LazyFoo ref={ref} />
1184
</Suspense>,
1185
{
1186
- isConcurrent: true,
1186
+ unstable_isConcurrent: true,
1187
},
1188
);
1189
@@ -1223,7 +1223,7 @@ describe('ReactLazy', () => {
1223
<LazyText text="Hi" />
1224
</Suspense>
1225
</ErrorBoundary>,
1226
- {isConcurrent: true},
1226
+ {unstable_isConcurrent: true},
1227
);
1228
1229
await waitForAll(['Loading...']);
@@ -1331,7 +1331,7 @@ describe('ReactLazy', () => {
1331
}
1332
1333
const root = ReactTestRenderer.create(<Parent swap={false} />, {
1334
- isConcurrent: true,
1334
+ unstable_isConcurrent: true,
1335
});
1336
1337
await waitForAll(['Init A', 'Loading...']);
@@ -1416,7 +1416,7 @@ describe('ReactLazy', () => {
1416
}
1417
1418
const root = ReactTestRenderer.create(<Parent swap={false} />, {
1419
- isConcurrent: false,
1419
+ unstable_isConcurrent: false,
1420
});
1421
1422
assertLog(['Init A', 'Init B', 'Loading...']);
@@ -1478,7 +1478,7 @@ describe('ReactLazy', () => {
1478
}
1479
1480
const root = ReactTestRenderer.create(<Parent swap={false} />, {
1481
- isConcurrent: true,
1481
+ unstable_isConcurrent: true,
1482
});
1483
1484
await waitForAll(['Init A', 'Loading...']);
@@ -1547,7 +1547,7 @@ describe('ReactLazy', () => {
1547
}
1548
1549
const root = ReactTestRenderer.create(<Parent swap={false} />, {
1550
- isConcurrent: false,
1550
+ unstable_isConcurrent: false,
1551
});
1552
1553
assertLog(['Init A', 'Loading...']);
packages/react-test-renderer/src/ReactTestRenderer.js
+1
-5
@@ -63,7 +63,6 @@ const act = React.act;
63
64
type TestRendererOptions = {
65
createNodeMock: (element: React$Element<any>) => any,
66
- isConcurrent: boolean,
66
unstable_isConcurrent: boolean,
67
unstable_strictMode: boolean,
68
unstable_concurrentUpdatesByDefault: boolean,
@@ -491,10 +490,7 @@ function create(
490
// $FlowFixMe[incompatible-type] found when upgrading Flow
491
createNodeMock = options.createNodeMock;
492
}
494
- if (
495
- options.unstable_isConcurrent === true ||
496
- options.isConcurrent === true
497
- ) {
493
+ if (options.unstable_isConcurrent === true) {
494
isConcurrent = true;
495
}
496
if (options.unstable_strictMode === true) {
packages/react-test-renderer/src/__tests__/ReactTestRendererAsync-test.js
+4
-4
@@ -34,7 +34,7 @@ describe('ReactTestRendererAsync', () => {
34
return props.children;
35
}
36
const renderer = ReactTestRenderer.create(<Foo>Hi</Foo>, {
37
- isConcurrent: true,
37
+ unstable_isConcurrent: true,
38
});
39
40
// Before flushing, nothing has mounted.
@@ -68,7 +68,7 @@ describe('ReactTestRendererAsync', () => {
68
);
69
}
70
const renderer = ReactTestRenderer.create(<Parent step={1} />, {
71
- isConcurrent: true,
71
+ unstable_isConcurrent: true,
72
});
73
74
await waitForAll(['A:1', 'B:1', 'C:1']);
@@ -97,7 +97,7 @@ describe('ReactTestRendererAsync', () => {
97
let renderer;
98
React.startTransition(() => {
99
renderer = ReactTestRenderer.create(<Parent step={1} />, {
100
- isConcurrent: true,
100
+ unstable_isConcurrent: true,
101
});
102
});
103
@@ -137,7 +137,7 @@ describe('ReactTestRendererAsync', () => {
137
let renderer;
138
React.startTransition(() => {
139
renderer = ReactTestRenderer.create(<Example step={1} />, {
140
- isConcurrent: true,
140
+ unstable_isConcurrent: true,
141
});
142
});
143
packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js
+1
-1
@@ -154,7 +154,7 @@ describe('ReactProfiler DevTools integration', () => {
154
return text;
155
}
156
157
- const root = ReactTestRenderer.create(null, {isConcurrent: true});
157
+ const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
158
159
// Commit something
160
root.update(<Text text="A" />);
packages/react/src/__tests__/ReactStartTransition-test.js
+1
-1
@@ -49,7 +49,7 @@ describe('ReactStartTransition', () => {
49
50
await act(() => {
51
ReactTestRenderer.create(<Component level={0} />, {
52
- isConcurrent: true,
52
+ unstable_isConcurrent: true,
53
});
54
});
55