-
-
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
[system] Pass the stylesheet directly to GlobalStyles
#43739
Conversation
Netlify deploy previewhttps://deploy-preview-43739--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
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.
@siriwatknp could we add a test for this?
…gen-css-vars-order
Added a regression test (I think for use case like this, it's best to run the test in the real browser env). Also, tested with sandbox build, it fixes the issue. https://app.argos-ci.com/mui/material-ui/builds/32120/109050219 |
To unblock #43708
Added regression test: https://app.argos-ci.com/mui/material-ui/builds/32120/109050219
Root cause
After the fix from #43632, if
<StyledEngineProvider injectFirst>
is used, the global style injection order is included in the Emotion normal process likestyled
API. Meaning that Emotion will process the end of the GlobalStyles first. For example,Screen.Recording.2567-09-13.at.11.49.57.mov
This causes unexpected behavior because the way CSS variables are generated should be ordered by:
Fix
This PR put the ordered stylesheet into a single
GlobalStyles
so that the injection order does not matter.Screen.Recording.2567-09-13.at.11.51.36.mov