Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update isConcurrent RTR option usage #28546

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ describe('ReactHooksInspectionIntegration', () => {
);
}
const renderer = await act(() => {
return ReactTestRenderer.create(<Foo />, {isConcurrent: true});
return ReactTestRenderer.create(<Foo />, {unstable_isConcurrent: true});
});
expect(renderer).toMatchRenderedOutput(null);
let childFiber = renderer.root.findByType(Foo)._currentFiber();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('InspectedElement', () => {
// Used by inspectElementAtIndex() helper function
utils.act(() => {
testRendererInstance = TestRenderer.create(null, {
isConcurrent: true,
unstable_isConcurrent: true,
});
});

Expand Down Expand Up @@ -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,
});
},
);
Expand Down Expand Up @@ -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,
});
},
);
Expand Down Expand Up @@ -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,
});
},
);
Expand Down Expand Up @@ -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,
});
},
);
Expand Down Expand Up @@ -2405,7 +2405,7 @@ describe('InspectedElement', () => {
<Suspender target={id} />
</React.Suspense>
</Contexts>,
{isConcurrent: true},
{unstable_isConcurrent: true},
);
}, false);
await utils.actAsync(() => {
Expand Down Expand Up @@ -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,
});
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('ErrorBoundaryReconciliation', () => {
<ErrorBoundary fallbackTagName={fallbackTagName}>
<BrokenRender fail={false} />
</ErrorBoundary>,
{isConcurrent: isConcurrent},
{unstable_isConcurrent: isConcurrent},
);
});
expect(renderer).toMatchRenderedOutput(<span prop="BrokenRender" />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('ReactHooks', () => {
return <Child text={text} />;
}

const root = ReactTestRenderer.create(null, {isConcurrent: true});
const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
root.update(<Parent />);
await waitForAll(['Parent: 0, 0', 'Child: 0, 0', 'Effect: 0, 0']);
expect(root).toMatchRenderedOutput('0, 0');
Expand Down Expand Up @@ -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(<Parent theme="light" />);
await waitForAll(['Parent: 0, 0 (light)', 'Child: 0, 0 (light)']);
expect(root).toMatchRenderedOutput('0, 0 (light)');
Expand Down Expand Up @@ -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(<Counter />);
await waitForAll(['Count: 0']);
expect(root).toMatchRenderedOutput('0');
Expand Down Expand Up @@ -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(<Counter />);
await waitForAll(['Count: 0']);
expect(root).toMatchRenderedOutput('0');
Expand Down Expand Up @@ -322,7 +322,7 @@ describe('ReactHooks', () => {
});
return <Child text={text} />;
}
const root = ReactTestRenderer.create(null, {isConcurrent: true});
const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
await act(() => {
root.update(
<ThemeProvider>
Expand Down Expand Up @@ -390,7 +390,7 @@ describe('ReactHooks', () => {
return <Child text={counter} />;
}

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

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

const root = ReactTestRenderer.create(null, {isConcurrent: true});
const root = ReactTestRenderer.create(null, {unstable_isConcurrent: true});
root.update(<Parent />);
await waitForAll(['Parent: 1', 'Child: 1']);
expect(root).toMatchRenderedOutput('1');
Expand Down
50 changes: 25 additions & 25 deletions packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('ReactLazy', () => {
<LazyText text="Hi" />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);

Expand Down Expand Up @@ -183,7 +183,7 @@ describe('ReactLazy', () => {
<LazyBar />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);

Expand All @@ -206,7 +206,7 @@ describe('ReactLazy', () => {
const LazyText = lazy(async () => Text);

const root = ReactTestRenderer.create(null, {
isConcurrent: true,
unstable_isConcurrent: true,
});

let error;
Expand Down Expand Up @@ -240,7 +240,7 @@ describe('ReactLazy', () => {
});

const root = ReactTestRenderer.create(null, {
isConcurrent: true,
unstable_isConcurrent: true,
});

let error;
Expand Down Expand Up @@ -300,7 +300,7 @@ describe('ReactLazy', () => {
}

const root = ReactTestRenderer.create(<Parent swap={false} />, {
isConcurrent: true,
unstable_isConcurrent: true,
});

await waitForAll(['Suspend! [LazyChildA]', 'Loading...']);
Expand Down Expand Up @@ -335,7 +335,7 @@ describe('ReactLazy', () => {
<LazyText />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);

Expand Down Expand Up @@ -392,7 +392,7 @@ describe('ReactLazy', () => {
</Lazy>
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);
await waitForAll(['Loading...']);
Expand Down Expand Up @@ -438,7 +438,7 @@ describe('ReactLazy', () => {
</Suspense>
</>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);
await waitForAll(['Not lazy: 0', 'Loading...']);
Expand Down Expand Up @@ -483,7 +483,7 @@ describe('ReactLazy', () => {
</Suspense>
</>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);
await waitForAll(['Not lazy: 0', 'Loading...']);
Expand Down Expand Up @@ -559,7 +559,7 @@ describe('ReactLazy', () => {
<LazyClass num={1} />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);

Expand Down Expand Up @@ -689,7 +689,7 @@ describe('ReactLazy', () => {
<LazyText />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);

Expand Down Expand Up @@ -732,7 +732,7 @@ describe('ReactLazy', () => {
<BadLazy />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);

Expand All @@ -759,7 +759,7 @@ describe('ReactLazy', () => {
<Lazy2 text="Hello" />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);

Expand Down Expand Up @@ -792,7 +792,7 @@ describe('ReactLazy', () => {
<LazyAdd inner="2" outer="2" />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);

Expand Down Expand Up @@ -939,7 +939,7 @@ describe('ReactLazy', () => {
<LazyText />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);

Expand Down Expand Up @@ -977,7 +977,7 @@ describe('ReactLazy', () => {
<LazyFoo />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);

Expand Down Expand Up @@ -1022,7 +1022,7 @@ describe('ReactLazy', () => {
<LazyForwardRef ref={ref} />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);

Expand Down Expand Up @@ -1053,7 +1053,7 @@ describe('ReactLazy', () => {
<LazyAdd outer={2} />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);
await waitForAll(['Loading...']);
Expand Down Expand Up @@ -1140,7 +1140,7 @@ describe('ReactLazy', () => {
<LazyAdd outer={2} />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);
await waitForAll(['Loading...']);
Expand Down Expand Up @@ -1187,7 +1187,7 @@ describe('ReactLazy', () => {
<LazyFoo ref={ref} />
</Suspense>,
{
isConcurrent: true,
unstable_isConcurrent: true,
},
);

Expand Down Expand Up @@ -1227,7 +1227,7 @@ describe('ReactLazy', () => {
<LazyText text="Hi" />
</Suspense>
</ErrorBoundary>,
{isConcurrent: true},
{unstable_isConcurrent: true},
);

await waitForAll(['Loading...']);
Expand Down Expand Up @@ -1335,7 +1335,7 @@ describe('ReactLazy', () => {
}

const root = ReactTestRenderer.create(<Parent swap={false} />, {
isConcurrent: true,
unstable_isConcurrent: true,
});

await waitForAll(['Init A', 'Loading...']);
Expand Down Expand Up @@ -1420,7 +1420,7 @@ describe('ReactLazy', () => {
}

const root = ReactTestRenderer.create(<Parent swap={false} />, {
isConcurrent: false,
unstable_isConcurrent: false,
});

assertLog(['Init A', 'Init B', 'Loading...']);
Expand Down Expand Up @@ -1482,7 +1482,7 @@ describe('ReactLazy', () => {
}

const root = ReactTestRenderer.create(<Parent swap={false} />, {
isConcurrent: true,
unstable_isConcurrent: true,
});

await waitForAll(['Init A', 'Loading...']);
Expand Down Expand Up @@ -1551,7 +1551,7 @@ describe('ReactLazy', () => {
}

const root = ReactTestRenderer.create(<Parent swap={false} />, {
isConcurrent: false,
unstable_isConcurrent: false,
});

assertLog(['Init A', 'Loading...']);
Expand Down
6 changes: 1 addition & 5 deletions packages/react-test-renderer/src/ReactTestRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const act = React.act;

type TestRendererOptions = {
createNodeMock: (element: React$Element<any>) => any,
isConcurrent: boolean,
unstable_isConcurrent: boolean,
unstable_strictMode: boolean,
unstable_concurrentUpdatesByDefault: boolean,
Expand Down Expand Up @@ -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) {
Expand Down
Loading