material-ui
material-ui copied to clipboard
[core] Remove unnecessary conditional around `.muiName = `
This was added in #42001. Why?
Netlify deploy preview
https://deploy-preview-44071--material-ui.netlify.app/
Bundle size report
Details of bundle changes (Toolpad) Details of bundle changes
Generated by :no_entry_sign: dangerJS against 14761c3ea227e7ee6164bee76055c354378480c7
It could be a use case for https://github.com/mui/pigment-css/issues/84.
I have tried to apply this change with https://github.com/mui/material-ui/tree/4bcf32bbb8db43c5fe8c52d300116af00aae40d1/examples/material-ui-pigment-css-vite-ts (and found #44074 along the way), it seems to work fine. A big 💯 to move in this direction. If this code branche is needed, then muiName isn't applied, then it's broken, so in any cases, we can't have this code branch.
Yep, also found that adding .displayName to a styled component breaks pigment. Still investigating.
I can confirm that it was added during the migration of Pigment CSS, because otherwise it breaks Pigment CSS. @brijeshb42 can likely share more info on why (or @siriwatknp as he was mainly driving the migration).
It is fine to remove now since we added a fix in the Pigment transform itself.
It is fine to remove now since we added a fix in the Pigment transform itself.
Does the fix apply to .displayName as well? It seems to break pigment in https://github.com/mui/material-ui/pull/44067
On inspecting the code, I see that we only handle muiName and propTypes. We'll also need to add check for displayName.
There is also defaultProps, and Toolpad is also attaching a static (Symbol) property to the component. I've seen other tools rely on similar patterns. Would it be possible to support just any static property on a component?
Sorry for the delay, this PR got buried. @brijeshb42 can you confirm if we can merge this one?
We can merge it as long as the example apps (during CI) are building correctly after rebasing.
Nice
https://tools-public.mui.com/prod/pages/bundleSizes?circleCIBuildNumber=780755&baseRef=master&baseCommit=cef5e6cd7af197c835acb3b1a37733f7e82902f2&prNumber=44071