Skip to content

Commit ff31942

Browse files
author
Jack Pope
committed
Only concurrent render in RTR
1 parent ddf78a7 commit ff31942

16 files changed

+441
-239
lines changed

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ describe('DebugTracing', () => {
7171
<React.unstable_DebugTracingMode>
7272
<div />
7373
</React.unstable_DebugTracingMode>,
74+
{unstable_isConcurrent: true},
75+
7476
),
7577
);
7678
expect(logs).toEqual([]);
@@ -180,6 +182,10 @@ describe('DebugTracing', () => {
180182
<Example />
181183
</React.Suspense>
182184
</React.unstable_DebugTracingMode>,
185+
<<<<<<< HEAD
186+
=======
187+
{unstable_isConcurrent: true},
188+
>>>>>>> b81de30fc (Flip default to concurrent render in RTR)
183189
),
184190
);
185191

@@ -216,6 +222,7 @@ describe('DebugTracing', () => {
216222
</React.Suspense>
217223
</Wrapper>
218224
</React.unstable_DebugTracingMode>,
225+
{unstable_isConcurrent: true},
219226
),
220227
);
221228

@@ -246,6 +253,7 @@ describe('DebugTracing', () => {
246253
<React.unstable_DebugTracingMode>
247254
<Example />
248255
</React.unstable_DebugTracingMode>,
256+
{unstable_isConcurrent: true},
249257
),
250258
);
251259

@@ -276,11 +284,10 @@ describe('DebugTracing', () => {
276284
<React.unstable_DebugTracingMode>
277285
<Example />
278286
</React.unstable_DebugTracingMode>,
279-
);
280-
});
281-
}).toErrorDev(
282-
'Warning: Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.',
283-
);
287+
{unstable_isConcurrent: true},
288+
),
289+
);
290+
}).toErrorDev('Cannot update during an existing state transition');
284291

285292
expect(logs).toEqual([
286293
`group: ⚛️ render (${DEFAULT_LANE_STRING})`,
@@ -304,6 +311,7 @@ describe('DebugTracing', () => {
304311
<React.unstable_DebugTracingMode>
305312
<Example />
306313
</React.unstable_DebugTracingMode>,
314+
{unstable_isConcurrent: true},
307315
),
308316
);
309317

@@ -331,6 +339,7 @@ describe('DebugTracing', () => {
331339
<React.unstable_DebugTracingMode>
332340
<Example />
333341
</React.unstable_DebugTracingMode>,
342+
{unstable_isConcurrent: true},
334343
);
335344
});
336345
expect(logs).toEqual([
@@ -355,6 +364,7 @@ describe('DebugTracing', () => {
355364
<React.unstable_DebugTracingMode>
356365
<Example />
357366
</React.unstable_DebugTracingMode>,
367+
{unstable_isConcurrent: true},
358368
);
359369
});
360370

@@ -377,6 +387,7 @@ describe('DebugTracing', () => {
377387
<React.unstable_DebugTracingMode>
378388
<Example />
379389
</React.unstable_DebugTracingMode>,
390+
{unstable_isConcurrent: true},
380391
),
381392
);
382393

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,7 @@ describe('ReactHooks', () => {
18991899
}).rejects.toThrow('Hello');
19001900

19011901
if (__DEV__) {
1902-
expect(console.error).toHaveBeenCalledTimes(2);
1902+
expect(jest.mocked(console.error)).toHaveBeenCalledTimes(2);
19031903
expect(console.error.mock.calls[0][0]).toContain(
19041904
'Warning: Cannot update a component (`%s`) while rendering ' +
19051905
'a different component (`%s`).',

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import {ConcurrentRoot, LegacyRoot} from 'react-reconciler/src/ReactRootTags';
5555
import {
5656
allowConcurrentByDefault,
5757
enableReactTestRendererWarning,
58+
enableReactTestRendererLegacyMode,
5859
} from 'shared/ReactFeatureFlags';
5960

6061
const act = React.act;
@@ -482,16 +483,16 @@ function create(
482483
}
483484

484485
let createNodeMock = defaultTestOptions.createNodeMock;
485-
let isConcurrent = false;
486+
let isConcurrent = true;
486487
let isStrictMode = false;
487488
let concurrentUpdatesByDefault = null;
488489
if (typeof options === 'object' && options !== null) {
489490
if (typeof options.createNodeMock === 'function') {
490491
// $FlowFixMe[incompatible-type] found when upgrading Flow
491492
createNodeMock = options.createNodeMock;
492493
}
493-
if (options.unstable_isConcurrent === true) {
494-
isConcurrent = true;
494+
if (enableReactTestRendererLegacyMode) {
495+
isConcurrent = options.unstable_isConcurrent;
495496
}
496497
if (options.unstable_strictMode === true) {
497498
isStrictMode = true;

0 commit comments

Comments
 (0)