Cannot turn off "potentially unsafe when doing server-side rendering" noise
See original GitHub issueEmotion 10 is emitting a series of console warnings along the lines of:
The pseudo class ":first-child" is potentially unsafe when doing server-side rendering. Try changing it to "first-of-type"
The pseudo class ":nth-child" is potentially unsafe when doing server-side rendering. Try changing it to "nth-of-type"
emotion
version: 10.0.4react
version: 16.7.0-alpha2
Problem description:
- I’m not using server-side rendering so these warnings aren’t useful for me and are just console noise that means real problems will be masked. Apart from running in a production build, I can’t see any way to turn these warnings off right now.
- The error message doesn’t help me understand why these pseudo classes are a problem; I can’t find them mentioned in the Emotion docs, or references on the Internet as to why these might be a problem.
Suggested solution:
- Provide a way to turn off these warnings if users don’t want them.
- Provide a link, or some documentation, as to why these pseudos are problematic.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:100
- Comments:61 (34 by maintainers)
Top Results From Across the Web
Bootstrap: The pseudo class “: first child” is potentially ...
Cannot turn off "potentially unsafe when doing server-side rendering" noise. Emotion 10 is emitting a series of console warnings along the ...
Read more >The pseudo class ":first-child" is potentially unsafe when doing ...
css - The pseudo class ":first-child" is potentially unsafe when doing server-side rendering. Try changing it to ":first-of-type" - Stack ...
Read more >The Pseudo Class ":First-Child" Is Potentially Unsafe When ...
Cannot turn off potentially unsafe when doing serverside rendering noise along the lines of: The pseudo class :firstchild is potentially unsafe when doing....
Read more >Mitigate cross-site scripting (XSS) with a strict Content Security ...
Learn how to deploy a CSP based on script nonces or hashes as a defense-in-depth against cross-site scripting.
Read more >Server Side Rendering - Emotion
This approach does not work with the streaming APIs. On server. When using @emotion/react. import { CacheProvider } ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Folks,
The inability to disable these console messages is a blocker for us being able to ship the Emotion 10 update to our component library. As a library, these messages are also visible to all of our downstream consumers.
We do not wish to update the selector usage in our library as we do not believe Emotion’s current SSR strategy to be a valid trade-off for breaking numerous commonly used CSS selectors, hence #1178. We are hopeful that an alternate approach can be found there as well, but in the mean time, simply would like to disable these console messages.
Is there anything that can be done here to move things forward? We are willing to do the work, or collaborate, if you can provide some insight into the direction that you would like to take.
Possible Solutions
Additional Considerations
Lastly, thank you for all of your efforts in creating and maintaining this project, which solves a lot of our problems!
You can disable currently this by using comment in your styled: