-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[example] update EmotionCacheProvider to work with GlobalStyles #37962
Conversation
Netlify deploy previewhttps://deploy-preview-37962--material-ui.netlify.app/ Bundle size report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works 🙌
Thanks for digging into this @siriwatknp 🙏
examples/joy-next-app-router-ts/src/components/ThemeRegistry/EmotionCache.tsx
Outdated
Show resolved
Hide resolved
examples/joy-next-app-router-ts/src/components/ThemeRegistry/EmotionCache.tsx
Outdated
Show resolved
Hide resolved
examples/joy-next-app-router-ts/src/components/ThemeRegistry/EmotionCache.tsx
Outdated
Show resolved
Hide resolved
examples/material-next-app-router-ts/src/components/ThemeRegistry/EmotionCache.tsx
Outdated
Show resolved
Hide resolved
examples/material-next-app-router-ts/src/components/ThemeRegistry/EmotionCache.tsx
Outdated
Show resolved
Hide resolved
examples/material-next-app-router-ts/src/components/ThemeRegistry/EmotionCache.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Daniel Schiavini <[email protected]> Signed-off-by: Siriwat K <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks @DanielSchiavini for the final reivew!
closes #37935
Root cause
The previous version include global styles into one style tag:
Then when changing to dark mode, the client-side global is inserted but emotion adds it at the top so it be:
The client-side global cannot override the server-side global due to cascading order.