You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
createGlobalStyle: global styles whose rules are only functions share one id, so only the last one renders (6.4.0+) #5845
Two createGlobalStyle components whose whole body is a function interpolation end up with the same component id. Since 6.4.0, only the last one's CSS renders. This happens in SSR and in the browser.
constA=createGlobalStyle`${()=>'body{--a:1}'}`constB=createGlobalStyle`${()=>'html{--b:1}'}`// render <A /> and <B />: only --b is in the output// same with the function-argument formconstC=createGlobalStyle(()=>css`body{--a:1}`)constD=createGlobalStyle(()=>css`html{--b:1}`)
Real-world impact: xstyled's <Preflight /> and <ColorModeProvider /> both use this shape, so rendering Preflight drops the color mode variables and breaks dark mode.
Which shapes collide
A and B
6.3.12
6.4.0 to 6.6.0, v7 prerelease, main
both whole-function bodies
A and B
B only
both createGlobalStyle(fn)
A and B
B only
function inside a rule (body{--a:${() => 1}})
A and B
A and B
one static, one whole-function
A and B
A and B
Cause
createGlobalStyle derives its id from generateComponentId(JSON.stringify(rules)). JSON.stringify serializes functions as null, so every global style whose rules are only functions hashes to the same sc-global-* id. That hashing is old. What changed in 6.4.0 is that instances of one id now share a single style group, so the later component's rules replace the earlier one's.
Activity
pullfrog commentedon Oct 29, 2026
quantizor commentedon Nov 25, 2026
Fixed in 6.7