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
Changed behavior for createGlobalStyle in v6.3.x #5632
Updating to v6.3.0 did break my global styles. I also see the following warning:
Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.
at u (/Users/koenpunt/Developer/koenpunt/kakhiel-web-secondary/node_modules/styled-components/src/constructors/createGlobalStyle.ts:32:17)
I think the culprit is here, because I do see a flash of the expected styles, but then those styles are removed.
Before the condition was if (!__SERVER__) {, and I think that using the presence of React.useLayoutEffect isn't a reliable check for whether the code is running in a client environment.
Hi, unfortunately this issue does not resolve the problem on my side.
I’m using styled-components v6.3.5 and createGlobalStyle styles are not applied at all (they never appear in the DOM). There are no errors or warnings in the console. I'm using react 19.2.3.
The same setup worked correctly in v6.2.0. After upgrading to v6.3.x, the global styles are simply missing.
Could someone please take a look at this?
Thanks.
Reacted by Florian Cargoët, Rubén and Vít Rozsíval
For me it initially seemed to work fine with the fix that was applied, although when working on another refactor I did experience some page renders where the globalstyle wasn't applied..
Thank you for reporting, if there's any additional information you could provide it would be helpful. Even better if someone is able to put together a minimal reproduction? There's a sandbox subproject in this repo that can be used/manipulated to show the problem.
Activity
quantizor commentedon Jan 11, 2026
Thanks, on it!
mariana-truta-zg commentedon Jan 12, 2026
Hi, unfortunately this issue does not resolve the problem on my side.
I’m using styled-components v6.3.5 and createGlobalStyle styles are not applied at all (they never appear in the DOM). There are no errors or warnings in the console. I'm using react 19.2.3.
The same setup worked correctly in v6.2.0. After upgrading to v6.3.x, the global styles are simply missing.
Could someone please take a look at this?
Thanks.
floriancargoet commentedon Jan 12, 2026
Similar issue for me. One of my global styles is rendered, the other one is missing.
koenpunt commentedon Jan 12, 2026
For me it initially seemed to work fine with the fix that was applied, although when working on another refactor I did experience some page renders where the globalstyle wasn't applied..
quantizor commentedon Jan 12, 2026
Thank you for reporting, if there's any additional information you could provide it would be helpful. Even better if someone is able to put together a minimal reproduction? There's a sandbox subproject in this repo that can be used/manipulated to show the problem.
macrozone commentedon Jan 13, 2026
similar problem, now downgrading to 6.2.0 from 6.3.5.
i am using multiple global styles, maybe that is the culprit?
react 19.2.1, nextjs 15.5.4
quantizor commentedon Jan 13, 2026
Can you please post your react and styled-components versions as well where you're encountering the bug? Really need more info here to help.
mariana-truta-zg commentedon Jan 13, 2026
I have a CodeSandbox with a simple example: https://codesandbox.io/p/sandbox/angry-swartz-n2fhfp. As you can see, it is using styled-components v6.2.0, and the global styles are applied correctly.
I created another sandbox with the exact same code, but using styled-components v6.3.5:
https://codesandbox.io/p/sandbox/thirsty-jerry-527tgm. In this version, the global styles are no longer being applied.
Did anything change in the way global styles should be implemented between these versions?
quantizor commentedon Jan 13, 2026
Hi, please try out
styled-components@prerelease(6.3.7-prerelease.0) and let me know if it helps.quantizor commentedon Jan 13, 2026
Updated prerelease to [email protected] with an additional RSC fix
quantizor commentedon Jan 13, 2026
[email protected]includes one additional improvement forcreateGlobalStylewhen used in conjunction withserver-onlyquantizor commentedon Jan 14, 2026
Please like the message if it fixes your issue, thanks.
quantizor commentedon Jan 14, 2026
One last tweak →
[email protected]Should fix #5641 which is related to the RSC changes but not this exact issue.
floriancargoet commentedon Jan 15, 2026
It fixes the issue on a simple case (https://codesandbox.io/p/sandbox/styled-components-repro-zgsh57, which didn't work at all with 6.3.5) but it doesn't fix it on my app. I'll try to create a MRE.
floriancargoet commentedon Jan 19, 2026
6.3.8didn't fix it for me. I'm sorry, I didn't find time to create a MRE.floriancargoet commentedon Jan 19, 2026
@quantizor
OK, I identified an easy to reproduce issue, I've updated my codesandbox: https://codesandbox.io/p/sandbox/styled-components-repro-zgsh57
When the global style component is inside a keyed component (
<Component key={key} />), it is not rendered when the key changes.vitro-gloat commentedon Jan 20, 2026
@quantizor Version
6.3.8fixes this issue for me, however it still has #5648 ... Will have to downgrade to6.2.0to "solve" both issues.floriancargoet commentedon Feb 9, 2026
6.3.9fixes it for me. Thanks!