Skip to content

Commit

Permalink
feat(v13): enable concurrent rendering by default (#1692)
Browse files Browse the repository at this point in the history
* feat!: enable concurrent rendering by default

* chore: tweaks
  • Loading branch information
mdjastrzebski authored Oct 25, 2024
1 parent 3abeac3 commit 383c241
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
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

0 comments on commit 383c241

Please sign in to comment.