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

[styles][withStyles] Expect React defaultProps warning in test #42752

Merged

Conversation

aarongarciah
Copy link
Member

@aarongarciah aarongarciah commented Jun 25, 2024

Context

React 18.3.0 started to Warn for deprecated defaultProps for function components. See https://github.com/facebook/react/blob/main/CHANGELOG.md#1830-april-25-2024. Since withStyles reads defaultProps from components, there's a couple of React component using defaultProps in tests that fail because of the React warnings.

This PR updates the tests to expect such React warning when running the tests with React 18.3.x

How to test

Tests should pass in CI because we still use React 18.2 by default. I tried running CI with React 18.3 but it failed.

To test it locally, you should update React to 18.3.1 and run the related tests (pnpm tc "withStyles") to verify everything works as expected.

@aarongarciah aarongarciah added test package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. React 19 support PRs required to support React 19 labels Jun 25, 2024
@aarongarciah aarongarciah mentioned this pull request Jun 25, 2024
15 tasks
@mui-bot
Copy link

mui-bot commented Jun 25, 2024

Netlify deploy preview

https://deploy-preview-42752--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against d1ed4e0

@aarongarciah aarongarciah merged commit a7f4b1a into mui:next Jun 26, 2024
22 checks passed
@aarongarciah aarongarciah deleted the expect-react-warning-default-props branch June 26, 2024 10:42
@aarongarciah aarongarciah removed the request for review from DiegoAndai June 26, 2024 10:42
@aarongarciah aarongarciah mentioned this pull request Jul 5, 2024
13 tasks
aarongarciah added a commit to aarongarciah/material-ui that referenced this pull request Jul 5, 2024
joserodolfofreitas pushed a commit to joserodolfofreitas/material-ui that referenced this pull request Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. React 19 support PRs required to support React 19 test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants