[core] Start the migration to makeStyles - #16146
Conversation
|
@oliviertassinari In #15023 you created a |
Details of bundle changes.Comparing: 85058cc...246ef62
|
2096f45 to
2156eb9
Compare
|
@joshwooding Going to disable the displayName part in production unless it's something that is wanted |
|
Have a look at |
|
@eps1lon I can't figure out why the |
|
@joshwooding Thanks for looking at the experimental React Dev Tool output for this change. Big +1 for optimizing for the upcoming version, rather than the current one. |
643eccc to
0cfc9ce
Compare
|
I think we shouldn't hide implementation details with display names. Implementation details get leaked anyway via devtools or react component stack traces. It's tempting to simplify it but in the end it might confuse even more people if they get stack traces that seem like circular references: instead of And react-devtools will be improved anyway as was already mentioned |
0cfc9ce to
da544e8
Compare
3aa1064 to
98f9353
Compare
|
@oliviertassinari Is it on purpose that |
94c52d7 to
3d45e61
Compare
@merceyz Yes, there is no class names. It's using inline-style. I don't understand the objective of the pull request. Could you update the description so everybody can follow what we change and why :)? Thanks! |
Ah, I see, Thanks
Sure, updated. |
3d45e61 to
b4beaab
Compare
|
@merceyz Thanks for providing more details! #15023 was closed because we might not go into this direction in the future. I think that we should explore a style adapter base strategy, a world where we can provide a naked, styled-components, JSS, linaria, etc. version of the components while using styled-components as the default style adapter and maintaining JSS for backward compatibility. The value here is that we can defuse the fears people have, too many people are building their design system from scratch. It's wasteful.
|
|
@oliviertassinari I'm aware, seems like a great idea. Would that change what The plan with this PR is just to make it easier to migrate away from |
|
@merceyz There are many challenges, one is with the API we expose. How do we minimize the amount of work needed? The advantage of the HOC is that we can take the naked components and wrap it. I will look for precedence in the industry. So far, I have seen two libraries exploring this path:
I'm excited about it! |
Same can be done with a hook, use a context to provide the style engine, fallback to JSS. |
@merceyz I don't see how this can work. I think that we should hold any migration effort so we can POC around different style adapter approaches. We will have a better understanding of what's important once we have evaluated all our options and found the best tradeoff. I think that we will be more efficient by not moving from withStyles to makeStyles until this point. What do you think? |
246ef62 to
b4beaab
Compare
|
I don't think the migration should happen in this PR either way. Sounds like a lot of change for one PR |
Could make the plugin do all the work (migration) but yeah, should probably hold off until a decision has been made. |
|
Alright, let's explore :D! |



Backstory
In #15023 @oliviertassinari started migrating
Tableto use the newmakeStylesAPI. For the tests and documentation to continue to work he made amuiComponenthelper. That function allowed the tests to get theuseStylesinstance, and the docs to get theclassNameand styles used. However the downside of this was overhead at runtime and more code.Goal
The goal of this PR is to use a babel plugin to inject the information needed by the tests and docs without the runtime overhead. And then migrate the components to
makeStylesNote
Title is a work in progress, edits welcome
Todo
muiDisplayNamemuiStylesOrCreatormakeStyles