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

[core] Remove unnecessary conditional around .muiName = #44071

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Janpot
Copy link
Member

@Janpot Janpot commented Oct 11, 2024

This was added in #42001. Why?

@mui-bot
Copy link

mui-bot commented Oct 11, 2024

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 🚫 dangerJS against 0cd73a8

@Janpot Janpot added the core Infrastructure work going on behind the scenes label Oct 11, 2024
@oliviertassinari
Copy link
Member

oliviertassinari commented Oct 11, 2024

It could be a use case for mui/pigment-css#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.

@Janpot
Copy link
Member Author

Janpot commented Oct 12, 2024

Yep, also found that adding .displayName to a styled component breaks pigment. Still investigating.

@mnajdova
Copy link
Member

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).

@brijeshb42
Copy link
Contributor

It is fine to remove now since we added a fix in the Pigment transform itself.

@Janpot Janpot marked this pull request as ready for review October 16, 2024 09:31
@Janpot
Copy link
Member Author

Janpot commented Oct 16, 2024

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 #44067

@brijeshb42
Copy link
Contributor

On inspecting the code, I see that we only handle muiName and propTypes. We'll also need to add check for displayName.

@Janpot
Copy link
Member Author

Janpot commented Oct 16, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants