[Container] classes generated wrongly after migration to emotion
See original GitHub issue- Something interesting happening to clsx if classes.disableGutters is undefined or classes.fixed is undefined
But both combination produces just first undefined?
- While using maxWitdh=false generates unnecessary class MuiContainer-maxWidthFalse
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
- generates class MuiContainer-maxWidthFalse
- Generates undefined classes on fixed, disableGutters properties while using clsx.
Expected Behavior 🤔
- Using maxWitdh=false should not generate class maxWidthFalse
- No undefined classes should be applied.
Steps to Reproduce 🕹
Updated version from “@material-ui/core”: “5.0.0-alpha.21” to “@material-ui/core”: “5.0.0-alpha.22” Reference playground
Overall this probably should be changed to this.
const useUtilityClasses = (styleProps) => {
const { classes = {}, fixed, disableGutters, maxWidth } = styleProps;
const maxWidthClassName = `maxWidth${capitalize(String(maxWidth))}`;
return {
root: clsx(
containerClasses.root,
classes.root,
typeof maxWidth === "string" && getContainerUtilityClass(maxWidthClassName),
typeof maxWidth === "string" && classes[maxWidthClassName],
fixed && containerClasses.fixed,
fixed && classes.fixed,
disableGutters && containerClasses.disableGutters,
disableGutters && classes.disableGutters,
)
};
};
Context 🔦
Updating version.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
[Container] classes generated wrongly after migration to emotion
Generates undefined classes on fixed, disableGutters properties while using clsx. Expected Behavior. Using maxWitdh=false should not generate ...
Read more >material v5 migration: migrate from JSS to Emotion
However, when I try to run my app, I have the following error on all child components but not on the root parent...
Read more >Migration to emotion - HackMD
Migration to emotion. Converting styles from JSS to emotion. Things to consider when migrating component's styles to emotion.
Read more >Why We're Breaking Up with CSS-in-JS - DEV Community
Hi, I'm Sam — software engineer at Spot and the 2nd most active maintainer of Emotion, a widely-popular CSS-in-JS library for React.
Read more >Material UI v5 is out, and I'm unsure if I like the move ... - Reddit
I'd love to hear people's experiences with Emotion and how it benefits ... I will say that that after reading over the migration...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@oliviertassinari Yes it works updated and I used https://ci.codesandbox.io/status/mui-org/material-ui/pr/24371 to find the correct pull request and how to install it to my repository.
OK let’s wait for the new version for now I think we can close it.