-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Prevent ServerStyleSheet generating empty style tags/elements #4327
base: main
Are you sure you want to change the base?
Prevent ServerStyleSheet generating empty style tags/elements #4327
Conversation
@quantizor would you please take a look at this one? It's going to save much of headaches with SSR |
@@ -16,7 +16,7 @@ export const outputSheet = (sheet: Sheet) => { | |||
|
|||
const names = sheet.names.get(id); | |||
const rules = tag.getGroup(group); | |||
if (names === undefined || rules.length === 0) continue; | |||
if (names === undefined || !names.size || rules.length === 0) continue; |
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.
I'm not sure about this change w.r.t. createGlobalStyle. Could you add a test verifying that cGS usage without any other components works as expected in SSR?
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.
Test added
Awesome, looks good. Can you settle the prettier job and then I'll approve? |
Done thank you for looking into this! |
It seems like this PR not ported over to v6 and with React 18 streaming, it's possible to insert empty style tag in middle of html.
It should fix this issue: #4289
Ported over from: b9e60f7