Skip to content

feat(v13): enable concurrent rendering by default #1692

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

Merged
merged 2 commits into from
Oct 25, 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
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
test:
needs: [install-cache-deps]
runs-on: ubuntu-latest
name: Test
name: Test (concurrent by default)
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -61,11 +61,10 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4


test-concurrent:
test-legacy:
needs: [install-cache-deps]
runs-on: ubuntu-latest
name: Test (concurrent mode)
name: Test (legacy)
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -74,7 +73,7 @@ jobs:
uses: ./.github/actions/setup-deps

- name: Test in concurrent mode
run: CONCURRENT_MODE=1 yarn test:ci
run: CONCURRENT_MODE=0 yarn test:ci

test-website:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions jest-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './src/matchers/extend-expect';

beforeEach(() => {
resetToDefaults();
if (process.env.CONCURRENT_MODE === '1') {
configure({ concurrentRoot: true });
if (process.env.CONCURRENT_MODE === '0') {
configure({ concurrentRoot: false });
}
});
2 changes: 1 addition & 1 deletion src/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test('configure() overrides existing config values', () => {
asyncUtilTimeout: 5000,
defaultDebugOptions: { message: 'debug message' },
defaultIncludeHiddenElements: false,
concurrentRoot: false,
concurrentRoot: true,
});
});

Expand Down
6 changes: 3 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export type Config = {
defaultDebugOptions?: Partial<DebugOptions>;

/**
* Set to `true` to enable concurrent rendering.
* Otherwise `render` will default to legacy synchronous rendering.
* Set to `false` to disable concurrent rendering.
* Otherwise `render` will default to concurrent rendering.
*/
concurrentRoot: boolean;
};
Expand All @@ -43,7 +43,7 @@ export type InternalConfig = Config & {
const defaultConfig: InternalConfig = {
asyncUtilTimeout: 1000,
defaultIncludeHiddenElements: false,
concurrentRoot: false,
concurrentRoot: true,
};

let config = { ...defaultConfig };
Expand Down
6 changes: 3 additions & 3 deletions src/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ export interface RenderOptions {
wrapper?: React.ComponentType<any>;

/**
* Set to `true` to enable concurrent rendering.
* Otherwise `render` will default to legacy synchronous rendering.
* Set to `false` to disable concurrent rendering.
* Otherwise `render` will default to concurrent rendering.
*/
concurrentRoot?: boolean | undefined;
concurrentRoot?: boolean;

createNodeMock?: (element: React.ReactElement) => unknown;
unstable_validateStringsRenderedWithinText?: boolean;
Expand Down
Loading