-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Stylesheet class names conflict with production build (issue with JSS minification) #1782
Comments
I can confirm that we had the same issue on our project. On production, JSS minify class names with a counter: Both are minified in an isolated fashion, so the first class of the MUI stylesheet is The workaround above, that I wrote, is just a trick to keep the counter sync for both stylesheets. |
It happened because I was helped to remove the |
So that's a matter of having a too rigid version dependency on material-ui. Unfortunately, until material-ui release a stable version, react-admin can't depend on a So I guess this problem can be fixed now by using exactly the same material-ui version as react-admin in your |
I can confirm that I had a similar problem with the stylesheets. After some investigation I had another @material-ui dependency besides the one that react-admin uses and somehow they started to conflict in a really weird way. Removing the "@material-ui" dependency fixed my stylesheet problems. I had to fallback to using the material-ui version that react-admin uses(was not a problem at all). Thank you guys for all your work! |
The issue should now be fixed since fa174b3#diff-47fb44765fe40371ceea73ac4cc821c6R6 |
Closing as the issue is normally fixed. Feel free to reopen if you still experience the problem. |
I re-open the issue since it seems that it isn't fixed yet. See #1927
|
Fix by downgrading material-ui in my |
This is fixed by #1909, to be released with 2.1.0. |
2.1.0 is released, this should now be fixed. |
@fzaninotto It seems that this issue persist with the 2.1.0 version maybe @Kmaschta or @jpetitcolas can confirm I'll stick with the @jpetitcolas solution for the moment |
Did you remove your |
Fixed in 2.2 by upgrading my material ui to match react-admin's: |
@chr15stevens You actually saved me hours of headache thank you a lot ! |
I opened an issue on the MUI repo for that. Feel free to add some precisions if needed: mui/material-ui#12781 |
From what I can see on the repository, Material-UI core is set as a dependency. Any specific reason for not having it as a peer dependency? react-admin/packages/ra-ui-materialui/package.json Lines 39 to 40 in dbaf337
@jpetitcolas Using a |
@fzaninotto and @djhi have the answers about the dependency choices. @oliviertassinari The idea behind the custom |
@Kmaschta Ok thank you for the context. |
Hi, Can we use this with rest api's developed in laravel ? |
@irfanDC You're commenting on a very specific issue here. What are you referring to exactly ? |
No issue, Just asking can we integrate react-admin with laravel as restfull api with axios - npm ? |
Hi @irfanDC , and thanks for your question. Of course, React Admin can work with any sort of API and you can plug any client you need. I can recommend the tutorial for a good start with this framework: https://marmelab.com/react-admin/ That said, as explained in the react-admin contributing guide, the right place to ask a "How To" question, get usage advice, or troubleshoot your own code, is Stack OverFlow. This makes your question easy to find by the core team, and the developer community. Unlike GitHub, Stack Overflow has great SEO, gamification, voting, and reputation. That's why we chose it, and decided to keep GitHub issues only for bugs and feature requests. So I'm closing this issue, and inviting you to ask your question at: http://stackoverflow.com/questions/tagged/react-admin Once you get a response, please continue to hang out on the react-admin channel in Stack Overflow. That way, you can help newcomers and share your expertise! |
Yes I understand, you can close the issue that is actually not, Thanks for quick response |
…versions of material-ui and creates conflicting withStyle HOC. See marmelab/react-admin#1782
I tried your workaround for my application which faces the identical issue. Unfortunately it didn't seem to have any affect. I then noticed that the latest version of
|
This issue gets old, and the jss API might have changed since then. |
Many's mileage will vary, but for me, choosing I don't know why material-ui has to make such a mess of versions and naming conventions and stuff...! |
We noticed a severe issue when passing our project in production. Our app seems to be empty:
Seems, because everything is correctly set up in the DOM:
The issue seems related to JSS, which has some troubles generating class names. Each time it see a
withStyles
, it increments a counter. Yet, it seems that MaterialUI andreact-admin
uses two distinct counters. Hence, when the classes are minified (removing the component display name), classes are renamed such as:jss1
,jss2
, etc.jss1
,jss2
, etc.This duplication cause the issue mentioned above.
We temporarily fixed it on our project side, using a custom class name generator, using the same counter for every classes.
Then we wrapped our
Admin
component in:Should I open a PR with this hack-ish fix? It looks like a critical issue, as it prevents from deploying react-admin to production. Yet, I'm not convinced by this solution.
The text was updated successfully, but these errors were encountered: