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

React 19 support #15342

Merged
merged 32 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7b80aa5
Update dependencies to material ui 6 and react 19
arminmeh Oct 25, 2024
d17bb44
Update peer dependencies
arminmeh Oct 25, 2024
1b77fc5
Fix build
arminmeh Oct 25, 2024
8357de2
Update tests pass with R19
arminmeh Oct 28, 2024
0d9a257
Add fixme comment for the picker test
arminmeh Oct 28, 2024
f86f6a8
Use latest RC and Material UI deps
arminmeh Nov 8, 2024
0aff60f
Revert version changes applied with the script
arminmeh Nov 8, 2024
c11196d
Revert lock file
arminmeh Nov 8, 2024
d668772
Formatting
arminmeh Nov 18, 2024
4a312a1
Fix React 18 versions of the tests
arminmeh Nov 18, 2024
d50a69e
Allow combination of R19 and MUI6
arminmeh Nov 18, 2024
7737f9e
Fix formatting
arminmeh Nov 18, 2024
63b2ad5
Add params and the defaults
arminmeh Nov 18, 2024
3fe9855
Update conditions
arminmeh Nov 18, 2024
243b553
Fix issues
arminmeh Nov 18, 2024
df52338
Fix conditions
arminmeh Nov 18, 2024
b218581
Update readme
arminmeh Nov 19, 2024
17976db
Revert lock file after rebase
arminmeh Nov 19, 2024
62a6ea4
Fix build
arminmeh Nov 19, 2024
42e9659
Update infinite loader test
arminmeh Nov 19, 2024
ae6897d
Adjust test for React < 19
arminmeh Nov 19, 2024
c762e60
Remove 'only'
arminmeh Nov 19, 2024
678a8aa
Update parameter's default
arminmeh Nov 19, 2024
c5c516b
Fix MobileDateRangePicker test
flaviendelangle Nov 19, 2024
0af3294
Update parameter description
arminmeh Nov 19, 2024
9243091
Fix Tree View tests
flaviendelangle Nov 19, 2024
96abbec
Revert back changes lost due to the rebase
arminmeh Nov 20, 2024
9316cd8
Update @mui/lab dependency in the v6 script
arminmeh Nov 21, 2024
7bd61c1
Add react-dom@19 peer dependency. Update readme files and doc pages
arminmeh Nov 21, 2024
6c7bb84
Trigger build
arminmeh Nov 21, 2024
529011d
Update readme
arminmeh Nov 21, 2024
2e5e2f5
Review: Lukas
flaviendelangle Nov 21, 2024
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
65 changes: 30 additions & 35 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ parameters:
description: The name of the workflow to run
type: string
default: pipeline
with-material-ui-6:
description: Use material-ui v6 for additional checks and tests
type: boolean
default: false
with-react-version:
description: The version of react to be used for the additional tests
type: string
default: stable
e2e-base-url:
description: The base url for running end-to-end test
type: string
Expand Down Expand Up @@ -90,11 +98,10 @@ commands:
git --no-pager diff HEAD

- when:
condition:
equal: [material-ui-v6, << pipeline.parameters.workflow >>]
condition: << pipeline.parameters.with-material-ui-6 >>
steps:
- run:
name: Install @mui/material@next
name: Install @mui/material v6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice correction. 👍 🙈

command: pnpm use-material-ui-v6

jobs:
Expand Down Expand Up @@ -349,50 +356,38 @@ workflows:
requires:
- checkout

react-next:
additional-tests:
when:
equal: [react-next, << pipeline.parameters.workflow >>]
# triggers:
# - schedule:
# cron: '0 0 * * *'
# filters:
# branches:
# only:
# - master
and:
- equal: [additional, << pipeline.parameters.workflow >>]
cherniavskii marked this conversation as resolved.
Show resolved Hide resolved
- or:
- equal: [true, << pipeline.parameters.with-material-ui-6 >>]
- not:
equal: ['stable', << pipeline.parameters.with-react-version >>]
cherniavskii marked this conversation as resolved.
Show resolved Hide resolved
jobs:
- test_unit:
<<: *default-context
react-version: next
name: test_unit-react@next
name: test_unit_additional
react-version: << pipeline.parameters.with-react-version >>
- test_browser:
<<: *default-context
react-version: next
name: test_browser-react@next
name: test_browser_additional
react-version: << pipeline.parameters.with-react-version >>
- test_regressions:
<<: *default-context
react-version: next
name: test_regressions-react@next
name: test_regressions_additional
react-version: << pipeline.parameters.with-react-version >>
- test_e2e:
<<: *default-context
react-version: next
name: test_e2e-react@next
name: test_e2e_additional
react-version: << pipeline.parameters.with-react-version >>

material-ui-v6:
additional-checks:
when:
equal: [material-ui-v6, << pipeline.parameters.workflow >>]
and:
- equal: [additional, << pipeline.parameters.workflow >>]
- equal: [true, << pipeline.parameters.with-material-ui-6 >>]
jobs:
- test_unit:
<<: *default-context
name: test_unit-material@next
- test_browser:
<<: *default-context
name: test_browser-material@next
- test_regressions:
<<: *default-context
name: test_regressions-material@next
- test_e2e:
<<: *default-context
name: test_e2e-material@next
- test_types:
<<: *default-context
name: test_types-material@next
name: test_types_additional
4 changes: 2 additions & 2 deletions docs/data/charts/getting-started/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ yarn add @mui/material @emotion/react @emotion/styled

```json
"peerDependencies": {
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function EditRating(props: GridRenderEditCellParams<any, number>) {
changedThroughKeyboard.current = false;
};

const handleRef = (element: HTMLElement | undefined) => {
const handleRef = (element: HTMLElement | null) => {
if (element) {
if (value !== 0) {
element.querySelector<HTMLElement>(`input[value="${value}"]`)!.focus();
Expand Down
4 changes: 2 additions & 2 deletions docs/data/data-grid/getting-started/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Please note that [react](https://www.npmjs.com/package/react) and [react-dom](ht

```json
"peerDependencies": {
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
```

Expand Down
4 changes: 2 additions & 2 deletions docs/data/date-pickers/getting-started/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ yarn add @mui/material @emotion/react @emotion/styled

```json
"peerDependencies": {
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
```

Expand Down
4 changes: 2 additions & 2 deletions docs/data/tree-view/getting-started/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ Please note that [react](https://www.npmjs.com/package/react) and [react-dom](ht

```json
"peerDependencies": {
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
```

Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts-pro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ This component has the following peer dependencies that you need to install as w
```json
"peerDependencies": {
"@mui/material": "^5.15.14 || ^6.0.0",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
```

Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts-pro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"@emotion/styled": "^11.8.1",
"@mui/material": "^5.15.14 || ^6.0.0",
"@mui/system": "^5.15.14 || ^6.0.0",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"@emotion/react": {
Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ This component has the following peer dependencies that you need to install as w
```json
"peerDependencies": {
"@mui/material": "^5.15.14 || ^6.0.0",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
```

Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"@emotion/styled": "^11.8.1",
"@mui/material": "^5.15.14 || ^6.0.0",
"@mui/system": "^5.15.14 || ^6.0.0",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"@emotion/react": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { expect } from 'chai';
import { ErrorBoundary, createRenderer, screen } from '@mui/internal-test-utils';
import { ErrorBoundary, createRenderer, screen, reactMajor } from '@mui/internal-test-utils';
import { useSkipAnimation } from './useSkipAnimation';
import { AnimationProvider } from './AnimationProvider';

Expand Down Expand Up @@ -37,17 +37,22 @@ describe('useSkipAnimation', () => {

const errorRef = React.createRef<any>();

const errorMessage1 = 'MUI X: Could not find the animation ref context.';
const errorMessage2 =
'It looks like you rendered your component outside of a ChartsContainer parent component.';
const errorMessage3 = 'The above error occurred in the <UseSkipAnimation> component:';
const expextedError =
reactMajor < 19
? [errorMessage1, errorMessage2, errorMessage3]
: `${errorMessage1}\n${errorMessage2}`;

expect(() =>
render(
<ErrorBoundary ref={errorRef}>
<UseSkipAnimation />
</ErrorBoundary>,
),
).toErrorDev([
'MUI X: Could not find the animation ref context.',
'It looks like you rendered your component outside of a ChartsContainer parent component.',
'The above error occurred in the <UseSkipAnimation> component:',
]);
).toErrorDev(expextedError);

expect((errorRef.current as any).errors).to.have.length(1);
expect((errorRef.current as any).errors[0].toString()).to.include(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { expect } from 'chai';
import { ErrorBoundary, createRenderer, screen } from '@mui/internal-test-utils';
import { ErrorBoundary, createRenderer, screen, reactMajor } from '@mui/internal-test-utils';
import { useHighlighted } from './useHighlighted';
import { HighlightedProvider } from './HighlightedProvider';
import { SeriesProvider } from '../SeriesProvider';
Expand All @@ -23,17 +23,22 @@ describe('useHighlighted', () => {

const errorRef = React.createRef<any>();

const errorMessage1 = 'MUI X: Could not find the highlighted ref context.';
const errorMessage2 =
'It looks like you rendered your component outside of a ChartsContainer parent component.';
const errorMessage3 = 'The above error occurred in the <UseHighlighted> component:';
const expextedError =
reactMajor < 19
? [errorMessage1, errorMessage2, errorMessage3]
: `${errorMessage1}\n${errorMessage2}`;

expect(() =>
render(
<ErrorBoundary ref={errorRef}>
<UseHighlighted />
</ErrorBoundary>,
),
).toErrorDev([
'MUI X: Could not find the highlighted ref context.',
'It looks like you rendered your component outside of a ChartsContainer parent component.',
'The above error occurred in the <UseHighlighted> component:',
]);
).toErrorDev(expextedError);

expect((errorRef.current as any).errors).to.have.length(1);
expect((errorRef.current as any).errors[0].toString()).to.include(
Expand Down
17 changes: 11 additions & 6 deletions packages/x-charts/src/hooks/useSeries.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { expect } from 'chai';
import { ErrorBoundary, createRenderer, screen } from '@mui/internal-test-utils';
import { ErrorBoundary, createRenderer, reactMajor, screen } from '@mui/internal-test-utils';
import { useSeries } from './useSeries';
import { SeriesProvider } from '../context/SeriesProvider';
import { PluginProvider } from '../internals';
Expand All @@ -22,17 +22,22 @@ describe('useSeries', () => {

const errorRef = React.createRef<any>();

const errorMessage1 = 'MUI X: Could not find the series ref context.';
const errorMessage2 =
'It looks like you rendered your component outside of a ChartsContainer parent component.';
const errorMessage3 = 'The above error occurred in the <UseSeries> component:';
const expextedError =
reactMajor < 19
? [errorMessage1, errorMessage2, errorMessage3]
: `${errorMessage1}\n${errorMessage2}`;

expect(() =>
render(
<ErrorBoundary ref={errorRef}>
<UseSeries />
</ErrorBoundary>,
),
).toErrorDev([
'MUI X: Could not find the series ref context.',
'It looks like you rendered your component outside of a ChartsContainer parent component.',
'The above error occurred in the <UseSeries> component:',
]);
).toErrorDev(expextedError);

expect((errorRef.current as any).errors).to.have.length(1);
expect((errorRef.current as any).errors[0].toString()).to.include(
Expand Down
17 changes: 11 additions & 6 deletions packages/x-charts/src/hooks/useSvgRef.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { expect } from 'chai';
import { ErrorBoundary, createRenderer, screen } from '@mui/internal-test-utils';
import { ErrorBoundary, createRenderer, reactMajor, screen } from '@mui/internal-test-utils';
import { useSvgRef } from './useSvgRef';
import { SvgRefProvider, useSurfaceRef } from '../context/SvgRefProvider';

Expand Down Expand Up @@ -30,17 +30,22 @@ describe('useSvgRef', () => {

const errorRef = React.createRef<any>();

const errorMessage1 = 'MUI X: Could not find the svg ref context.';
const errorMessage2 =
'It looks like you rendered your component outside of a ChartsContainer parent component.';
const errorMessage3 = 'The above error occurred in the <UseSvgRef> component:';
const expextedError =
reactMajor < 19
? [errorMessage1, errorMessage2, errorMessage3]
: `${errorMessage1}\n${errorMessage2}`;

expect(() =>
render(
<ErrorBoundary ref={errorRef}>
<UseSvgRef />
</ErrorBoundary>,
),
).toErrorDev([
'MUI X: Could not find the svg ref context.',
'It looks like you rendered your component outside of a ChartsContainer parent component.',
'The above error occurred in the <UseSvgRef> component:',
]);
).toErrorDev(expextedError);

expect((errorRef.current as any).errors).to.have.length(1);
expect((errorRef.current as any).errors[0].toString()).to.include(
Expand Down
2 changes: 1 addition & 1 deletion packages/x-data-grid-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@emotion/styled": "^11.8.1",
"@mui/icons-material": "^5.4.1 || ^6.0.0",
"@mui/material": "^5.15.14 || ^6.0.0",
"react": "^17.0.0 || ^18.0.0"
"react": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"@emotion/react": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function EditRating(props: GridRenderEditCellParams<any, number>) {
changedThroughKeyboard.current = false;
};

const handleRef = (element: HTMLElement | undefined) => {
const handleRef = (element: HTMLElement | null) => {
if (element) {
if (value !== 0) {
element.querySelector<HTMLElement>(`input[value="${value}"]`)!.focus();
Expand Down
4 changes: 2 additions & 2 deletions packages/x-data-grid-premium/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ This component has the following peer dependencies that you need to install as w
```json
"peerDependencies": {
"@mui/material": "^5.15.14 || ^6.0.0",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
```

Expand Down
4 changes: 2 additions & 2 deletions packages/x-data-grid-premium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
"@emotion/styled": "^11.8.1",
"@mui/material": "^5.15.14 || ^6.0.0",
"@mui/system": "^5.15.14 || ^6.0.0",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"@emotion/react": {
Expand Down
Loading
Loading