Skip to content

Commit 95ce3ba

Browse files
jackpopeAndyPengc12
authored andcommitted
Update isConcurrent RTR option usage (facebook#28546)
Reverting some of facebook#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. (facebook#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
1 parent 002e585 commit 95ce3ba

File tree

9 files changed

+49
-53
lines changed

9 files changed

+49
-53
lines changed

packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ describe('ReactHooksInspectionIntegration', () => {
10121012
);
10131013
}
10141014
const renderer = await act(() => {
1015-
return ReactTestRenderer.create(<Foo />, {isConcurrent: true});
1015+
return ReactTestRenderer.create(<Foo />, {unstable_isConcurrent: true});
10161016
});
10171017
expect(renderer).toMatchRenderedOutput(null);
10181018
let childFiber = renderer.root.findByType(Foo)._currentFiber();

packages/react-devtools-shared/src/__tests__/inspectedElement-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('InspectedElement', () => {
7777
// Used by inspectElementAtIndex() helper function
7878
utils.act(() => {
7979
testRendererInstance = TestRenderer.create(null, {
80-
isConcurrent: true,
80+
unstable_isConcurrent: true,
8181
});
8282
});
8383

@@ -356,7 +356,7 @@ describe('InspectedElement', () => {
356356
['An update to %s inside a test was not wrapped in act'],
357357
() => {
358358
testRendererInstance = TestRenderer.create(null, {
359-
isConcurrent: true,
359+
unstable_isConcurrent: true,
360360
});
361361
},
362362
);
@@ -510,7 +510,7 @@ describe('InspectedElement', () => {
510510
['An update to %s inside a test was not wrapped in act'],
511511
() => {
512512
testRendererInstance = TestRenderer.create(null, {
513-
isConcurrent: true,
513+
unstable_isConcurrent: true,
514514
});
515515
},
516516
);
@@ -2069,7 +2069,7 @@ describe('InspectedElement', () => {
20692069
['An update to %s inside a test was not wrapped in act'],
20702070
() => {
20712071
testRendererInstance = TestRenderer.create(null, {
2072-
isConcurrent: true,
2072+
unstable_isConcurrent: true,
20732073
});
20742074
},
20752075
);
@@ -2129,7 +2129,7 @@ describe('InspectedElement', () => {
21292129
['An update to %s inside a test was not wrapped in act'],
21302130
() => {
21312131
testRendererInstance = TestRenderer.create(null, {
2132-
isConcurrent: true,
2132+
unstable_isConcurrent: true,
21332133
});
21342134
},
21352135
);
@@ -2405,7 +2405,7 @@ describe('InspectedElement', () => {
24052405
<Suspender target={id} />
24062406
</React.Suspense>
24072407
</Contexts>,
2408-
{isConcurrent: true},
2408+
{unstable_isConcurrent: true},
24092409
);
24102410
}, false);
24112411
await utils.actAsync(() => {
@@ -2943,7 +2943,7 @@ describe('InspectedElement', () => {
29432943
['An update to %s inside a test was not wrapped in act'],
29442944
() => {
29452945
testRendererInstance = TestRenderer.create(null, {
2946-
isConcurrent: true,
2946+
unstable_isConcurrent: true,
29472947
});
29482948
},
29492949
);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('ErrorBoundaryReconciliation', () => {
5555
<ErrorBoundary fallbackTagName={fallbackTagName}>
5656
<BrokenRender fail={false} />
5757
</ErrorBoundary>,
58-
{isConcurrent: isConcurrent},
58+
{unstable_isConcurrent: isConcurrent},
5959
);
6060
});
6161
expect(renderer).toMatchRenderedOutput(<span prop="BrokenRender" />);

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('ReactHooks', () => {
8686
return <Child text={text} />;
8787
}
8888

89-
const root = ReactTestRenderer.create(null, {isConcurrent: true});
89+
const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
9090
root.update(<Parent />);
9191
await waitForAll(['Parent: 0, 0', 'Child: 0, 0', 'Effect: 0, 0']);
9292
expect(root).toMatchRenderedOutput('0, 0');
@@ -174,7 +174,7 @@ describe('ReactHooks', () => {
174174

175175
Parent = memo(Parent);
176176

177-
const root = ReactTestRenderer.create(null, {isConcurrent: true});
177+
const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
178178
root.update(<Parent theme="light" />);
179179
await waitForAll(['Parent: 0, 0 (light)', 'Child: 0, 0 (light)']);
180180
expect(root).toMatchRenderedOutput('0, 0 (light)');
@@ -232,7 +232,7 @@ describe('ReactHooks', () => {
232232
return counter;
233233
}
234234

235-
const root = ReactTestRenderer.create(null, {isConcurrent: true});
235+
const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
236236
root.update(<Counter />);
237237
await waitForAll(['Count: 0']);
238238
expect(root).toMatchRenderedOutput('0');
@@ -266,7 +266,7 @@ describe('ReactHooks', () => {
266266
return counter;
267267
}
268268

269-
const root = ReactTestRenderer.create(null, {isConcurrent: true});
269+
const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
270270
root.update(<Counter />);
271271
await waitForAll(['Count: 0']);
272272
expect(root).toMatchRenderedOutput('0');
@@ -322,7 +322,7 @@ describe('ReactHooks', () => {
322322
});
323323
return <Child text={text} />;
324324
}
325-
const root = ReactTestRenderer.create(null, {isConcurrent: true});
325+
const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
326326
await act(() => {
327327
root.update(
328328
<ThemeProvider>
@@ -390,7 +390,7 @@ describe('ReactHooks', () => {
390390
return <Child text={counter} />;
391391
}
392392

393-
const root = ReactTestRenderer.create(null, {isConcurrent: true});
393+
const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
394394
root.update(<Parent />);
395395
await waitForAll(['Parent: 0', 'Child: 0', 'Effect: 0']);
396396
expect(root).toMatchRenderedOutput('0');
@@ -465,7 +465,7 @@ describe('ReactHooks', () => {
465465
return <Child text={counter} />;
466466
}
467467

468-
const root = ReactTestRenderer.create(null, {isConcurrent: true});
468+
const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
469469
root.update(<Parent />);
470470
await waitForAll(['Parent: 0', 'Child: 0']);
471471
expect(root).toMatchRenderedOutput('0');
@@ -523,7 +523,7 @@ describe('ReactHooks', () => {
523523
return <Child text={counter} />;
524524
}
525525

526-
const root = ReactTestRenderer.create(null, {isConcurrent: true});
526+
const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
527527
root.update(<Parent />);
528528
await waitForAll(['Parent: 1', 'Child: 1']);
529529
expect(root).toMatchRenderedOutput('1');

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

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ describe('ReactLazy', () => {
9393
<LazyText text="Hi" />
9494
</Suspense>,
9595
{
96-
isConcurrent: true,
96+
unstable_isConcurrent: true,
9797
},
9898
);
9999

@@ -179,7 +179,7 @@ describe('ReactLazy', () => {
179179
<LazyBar />
180180
</Suspense>,
181181
{
182-
isConcurrent: true,
182+
unstable_isConcurrent: true,
183183
},
184184
);
185185

@@ -202,7 +202,7 @@ describe('ReactLazy', () => {
202202
const LazyText = lazy(async () => Text);
203203

204204
const root = ReactTestRenderer.create(null, {
205-
isConcurrent: true,
205+
unstable_isConcurrent: true,
206206
});
207207

208208
let error;
@@ -236,7 +236,7 @@ describe('ReactLazy', () => {
236236
});
237237

238238
const root = ReactTestRenderer.create(null, {
239-
isConcurrent: true,
239+
unstable_isConcurrent: true,
240240
});
241241

242242
let error;
@@ -296,7 +296,7 @@ describe('ReactLazy', () => {
296296
}
297297

298298
const root = ReactTestRenderer.create(<Parent swap={false} />, {
299-
isConcurrent: true,
299+
unstable_isConcurrent: true,
300300
});
301301

302302
await waitForAll(['Suspend! [LazyChildA]', 'Loading...']);
@@ -331,7 +331,7 @@ describe('ReactLazy', () => {
331331
<LazyText />
332332
</Suspense>,
333333
{
334-
isConcurrent: true,
334+
unstable_isConcurrent: true,
335335
},
336336
);
337337

@@ -388,7 +388,7 @@ describe('ReactLazy', () => {
388388
</Lazy>
389389
</Suspense>,
390390
{
391-
isConcurrent: true,
391+
unstable_isConcurrent: true,
392392
},
393393
);
394394
await waitForAll(['Loading...']);
@@ -434,7 +434,7 @@ describe('ReactLazy', () => {
434434
</Suspense>
435435
</>,
436436
{
437-
isConcurrent: true,
437+
unstable_isConcurrent: true,
438438
},
439439
);
440440
await waitForAll(['Not lazy: 0', 'Loading...']);
@@ -479,7 +479,7 @@ describe('ReactLazy', () => {
479479
</Suspense>
480480
</>,
481481
{
482-
isConcurrent: true,
482+
unstable_isConcurrent: true,
483483
},
484484
);
485485
await waitForAll(['Not lazy: 0', 'Loading...']);
@@ -555,7 +555,7 @@ describe('ReactLazy', () => {
555555
<LazyClass num={1} />
556556
</Suspense>,
557557
{
558-
isConcurrent: true,
558+
unstable_isConcurrent: true,
559559
},
560560
);
561561

@@ -685,7 +685,7 @@ describe('ReactLazy', () => {
685685
<LazyText />
686686
</Suspense>,
687687
{
688-
isConcurrent: true,
688+
unstable_isConcurrent: true,
689689
},
690690
);
691691

@@ -728,7 +728,7 @@ describe('ReactLazy', () => {
728728
<BadLazy />
729729
</Suspense>,
730730
{
731-
isConcurrent: true,
731+
unstable_isConcurrent: true,
732732
},
733733
);
734734

@@ -755,7 +755,7 @@ describe('ReactLazy', () => {
755755
<Lazy2 text="Hello" />
756756
</Suspense>,
757757
{
758-
isConcurrent: true,
758+
unstable_isConcurrent: true,
759759
},
760760
);
761761

@@ -788,7 +788,7 @@ describe('ReactLazy', () => {
788788
<LazyAdd inner="2" outer="2" />
789789
</Suspense>,
790790
{
791-
isConcurrent: true,
791+
unstable_isConcurrent: true,
792792
},
793793
);
794794

@@ -935,7 +935,7 @@ describe('ReactLazy', () => {
935935
<LazyText />
936936
</Suspense>,
937937
{
938-
isConcurrent: true,
938+
unstable_isConcurrent: true,
939939
},
940940
);
941941

@@ -973,7 +973,7 @@ describe('ReactLazy', () => {
973973
<LazyFoo />
974974
</Suspense>,
975975
{
976-
isConcurrent: true,
976+
unstable_isConcurrent: true,
977977
},
978978
);
979979

@@ -1018,7 +1018,7 @@ describe('ReactLazy', () => {
10181018
<LazyForwardRef ref={ref} />
10191019
</Suspense>,
10201020
{
1021-
isConcurrent: true,
1021+
unstable_isConcurrent: true,
10221022
},
10231023
);
10241024

@@ -1049,7 +1049,7 @@ describe('ReactLazy', () => {
10491049
<LazyAdd outer={2} />
10501050
</Suspense>,
10511051
{
1052-
isConcurrent: true,
1052+
unstable_isConcurrent: true,
10531053
},
10541054
);
10551055
await waitForAll(['Loading...']);
@@ -1136,7 +1136,7 @@ describe('ReactLazy', () => {
11361136
<LazyAdd outer={2} />
11371137
</Suspense>,
11381138
{
1139-
isConcurrent: true,
1139+
unstable_isConcurrent: true,
11401140
},
11411141
);
11421142
await waitForAll(['Loading...']);
@@ -1183,7 +1183,7 @@ describe('ReactLazy', () => {
11831183
<LazyFoo ref={ref} />
11841184
</Suspense>,
11851185
{
1186-
isConcurrent: true,
1186+
unstable_isConcurrent: true,
11871187
},
11881188
);
11891189

@@ -1223,7 +1223,7 @@ describe('ReactLazy', () => {
12231223
<LazyText text="Hi" />
12241224
</Suspense>
12251225
</ErrorBoundary>,
1226-
{isConcurrent: true},
1226+
{unstable_isConcurrent: true},
12271227
);
12281228

12291229
await waitForAll(['Loading...']);
@@ -1331,7 +1331,7 @@ describe('ReactLazy', () => {
13311331
}
13321332

13331333
const root = ReactTestRenderer.create(<Parent swap={false} />, {
1334-
isConcurrent: true,
1334+
unstable_isConcurrent: true,
13351335
});
13361336

13371337
await waitForAll(['Init A', 'Loading...']);
@@ -1416,7 +1416,7 @@ describe('ReactLazy', () => {
14161416
}
14171417

14181418
const root = ReactTestRenderer.create(<Parent swap={false} />, {
1419-
isConcurrent: false,
1419+
unstable_isConcurrent: false,
14201420
});
14211421

14221422
assertLog(['Init A', 'Init B', 'Loading...']);
@@ -1478,7 +1478,7 @@ describe('ReactLazy', () => {
14781478
}
14791479

14801480
const root = ReactTestRenderer.create(<Parent swap={false} />, {
1481-
isConcurrent: true,
1481+
unstable_isConcurrent: true,
14821482
});
14831483

14841484
await waitForAll(['Init A', 'Loading...']);
@@ -1547,7 +1547,7 @@ describe('ReactLazy', () => {
15471547
}
15481548

15491549
const root = ReactTestRenderer.create(<Parent swap={false} />, {
1550-
isConcurrent: false,
1550+
unstable_isConcurrent: false,
15511551
});
15521552

15531553
assertLog(['Init A', 'Loading...']);

packages/react-test-renderer/src/ReactTestRenderer.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ const act = React.act;
6363

6464
type TestRendererOptions = {
6565
createNodeMock: (element: React$Element<any>) => any,
66-
isConcurrent: boolean,
6766
unstable_isConcurrent: boolean,
6867
unstable_strictMode: boolean,
6968
unstable_concurrentUpdatesByDefault: boolean,
@@ -491,10 +490,7 @@ function create(
491490
// $FlowFixMe[incompatible-type] found when upgrading Flow
492491
createNodeMock = options.createNodeMock;
493492
}
494-
if (
495-
options.unstable_isConcurrent === true ||
496-
options.isConcurrent === true
497-
) {
493+
if (options.unstable_isConcurrent === true) {
498494
isConcurrent = true;
499495
}
500496
if (options.unstable_strictMode === true) {

0 commit comments

Comments
 (0)