[material-ui][Switch] Convert to support CSS extraction#41367
[material-ui][Switch] Convert to support CSS extraction#41367alexfauquette merged 4 commits intomui:masterfrom
Conversation
Netlify deploy previewhttps://deploy-preview-41367--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
|
Argos is failing, the variants conversion is somehow wrong. |
Struggled a bit to find why it's failing in the docs and not in the app. Seems it's because I verified that - .filter(([, value]) => value.main && value.mainChannel && value.light) // check all the used fields in the style below
+ .filter(([, value]) => value.main && value.light) // check all the used fields in the style below |
siriwatknp
left a comment
There was a problem hiding this comment.
The styles for disabled looks wrong from argos.
| }, | ||
| [`&.${switchClasses.disabled}`]: { |
| checkedIcon={icon} | ||
| ref={ref} | ||
| ownerState={ownerState} | ||
| color={color} |
There was a problem hiding this comment.
| color={color} |
No need to pass color as a prop here, the ownerState is enough.
There was a problem hiding this comment.
legacy of the debug session 🙈
| backgroundColor: 'transparent', | ||
| variants: [ | ||
| ...Object.entries(theme.palette) | ||
| .filter(([, value]) => value.main && value.light) // check all the used fields in the style below |
There was a problem hiding this comment.
This line broke our production code. We have an entry in the theme object that is sometimes undefined. This code doesn't handle that and assumes all values should be an object (which they are typically), but can also be numbers and strings. It doesn't fail there, but when the value is undefined.
| .filter(([, value]) => value.main && value.light) // check all the used fields in the style below | |
| .filter(([, value]) => value?.main && value?.light) // check all the used fields in the style below |
There was a problem hiding this comment.
Could you create a new issue so that I can assign to myself?

Part of #41273
The customization demo is broken, because styles does not apply on the root component.
For example in the ios switch example, the
width,heightandpaddingare not applied. But other classes are working fine 🤔About the
overridesResolverI'm not sure about how the newstyledreact to it. It's the first time I see it used with an array