-
Notifications
You must be signed in to change notification settings - Fork 30
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
Allowing components to be SSR-friendly by changing pseudo class ":first-child" to ":first-of-type" #158
Comments
Hi @cheton, In Narnia, we have also seen this issue happen when using checkbox and modal components as well, for the modal component in particular, the above error happens only the first time the click event to open the modal occurs, all subsequent events to open or close the modal do not produce any error. Note: The error is hidden when build in production mode via webpack. |
It will be fixed in PR #253 |
See emotion-js/emotion#1105 (comment) for details. Add Option 1css`
:first-child /* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */ {
color: hotpink;
}
` Option 2import { CacheProvider } from '@emotion/core'
import createCache from '@emotion/cache'
const myCache = createCache()
myCache.compat = true
<CacheProvider value={myCache}>
<App/>
</CacheProvider> Option 3import { cache } from 'emotion'
<CacheProvider value={cache}>
<App/>
</CacheProvider> |
A warning message reported by Next.js that the pseudo class
:first-child
is potentially unsafe when doing server-side rendering. Try changing it to:first-of-type
.Here are the component list that use the pseudo class ":first-child". It's suggested that we replace it with ":first-of-type" to make components to be SSR-friendly.
The text was updated successfully, but these errors were encountered: