-
-
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] set before
directly without using prepend for global styles
#44648
[system] set before
directly without using prepend for global styles
#44648
Conversation
before
directly without using prepend for global styles under <StyledEngine injectFirst>
before
directly without using prepend for global styles
Netlify deploy previewhttps://deploy-preview-44648--material-ui.netlify.app/ @mui/joy: parsed: +0.06% , gzip: +0.08% 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.
Hey @siriwatknp! Sorry for the delay
Have you identified with what change (PR) this broke from v5 to v6?
Should we also update this section and this warning on the docs?
packages/mui-styled-engine/src/StyledEngineProvider/StyledEngineProvider.js
Show resolved
Hide resolved
packages/mui-styled-engine/src/StyledEngineProvider/StyledEngineProvider.js
Show resolved
Hide resolved
packages/mui-styled-engine/src/StyledEngineProvider/StyledEngineProvider.js
Outdated
Show resolved
Hide resolved
packages/mui-styled-engine/src/StyledEngineProvider/StyledEngineProvider.js
Outdated
Show resolved
Hide resolved
…neProvider.js Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>
…styled-engine-inject-first
To be honest, I think they are separate issues, not specific to |
closes #44597
Root cause
Each
GlobalStyles
create its own sheet and injected at this line:This cause the 2nd GlobalStyles in the app to be injected above (
insertBefore
) the 1st GlobalStyles.Solution
set
before
to be the insertion point at theinsert
method of the custom sheet.Benefit of insertion point
prepend
(deprecated) is replaced byinsertionPoint
https://github.com/emotion-js/emotion/tree/main/packages/sheet#prepend.prepend
is unpredictable forGlobalStyles
. Different order ofGlobalStyles
and components produce different injection order 😮 (even without<StyledEngine injectFirst>
. This PR makes the order of GlobalStyles and components same as using the default cache.Test
Added a regression test. I don't think this can be easily tested with a unit test.