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

[material-ui] Support nested theme when upper theme is CSS vars theme #45604

Merged
merged 6 commits into from
Mar 18, 2025

Conversation

siriwatknp
Copy link
Member

Cherry pick from #45545 and #45368

Need this PR to release on v5 because MUI X docs depends on this version. To unblock #45386 so that the docs (both core and x) can migrate to CSS variables to fix the dark mode flicker issue.

@siriwatknp siriwatknp added package: material-ui Specific to @mui/material v5.x customization: theme Centered around the theming features labels Mar 18, 2025
@mui-bot
Copy link

mui-bot commented Mar 18, 2025

Netlify deploy preview

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

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against a96e725

@siriwatknp siriwatknp enabled auto-merge (squash) March 18, 2025 07:21
@siriwatknp siriwatknp disabled auto-merge March 18, 2025 07:21
@siriwatknp
Copy link
Member Author

Confirmed that it works with MUI X repo in combination with #45386

@siriwatknp siriwatknp merged commit 371a1fe into mui:v5.x Mar 18, 2025
18 checks passed
@JP250552
Copy link

I think there may be a breaking change with this.

Previously if you passed an empty object to the theme provider ({} rather than createTheme()), it would still create a full theme.

Now with this change, the theme looks like this:

{ vars: null }

@timmevandermeer
Copy link

I think there may be a breaking change with this.

Previously if you passed an empty object to the theme provider ({} rather than createTheme()), it would still create a full theme.

Now with this change, the theme looks like this:

{ vars: null }

I did experience a breaking change due to this release indeed (bisected to narrow it down to 5.17.0). In my case, setting my theme <ThemeProvider theme={theme}> which passed theme created by createTheme somehow caused React to enter an infinite render loop. I could only mitigate by changing to <ThemeProvider theme={() => theme}> to avoid the changed behavior from this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customization: theme Centered around the theming features package: material-ui Specific to @mui/material v5.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants