Skip to content
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

The pseudo class ":first-child" is potentially unsafe when doing server-side rendering. Try changing it to ":first-of-type #6113

Closed
cdolek opened this issue Aug 8, 2022 · 3 comments · Fixed by #6126

Comments

@cdolek
Copy link
Contributor

cdolek commented Aug 8, 2022

I get this warning in console, after upgrading to any version above v58.0.0

The pseudo class ":first-child" is potentially unsafe when doing server-side rendering. Try changing it to ":first-of-type
@thompsongl
Copy link
Contributor

Do you happen to have an Emotion cache configured? If so you can add the .compat = true option to bypass this: https://elastic.github.io/eui/#/utilities/provider#global-styles

@cdolek
Copy link
Contributor Author

cdolek commented Aug 8, 2022

@thompsongl No cache configured, using like this:

import {
  ThemeProvider as StyledThemeProvider,
  StyleSheetManager,
  createGlobalStyle,
} from 'styled-components/macro';

import { EuiProvider } from '@elastic/eui';
...
...
const App = () => {
  return (
    <StyleSheetManager disableVendorPrefixes>
      <EuiProvider colorMode="dark">
        <StyledThemeProvider theme={someTheme}>
          <GlobalStyle />
            ...
            ...
        </StyledThemeProvider>
      </EuiProvider>
    </StyleSheetManager>
  );
};

@cee-chen
Copy link
Contributor

cee-chen commented Aug 11, 2022

Can confirm this is reproducible when no cache is passed to EuiProvider: https://codesandbox.io/s/romantic-wilson-0oe88v?file=/index.js

I think I know why as well, we essentially need to use option 3 in emotion-js/emotion#1105 (comment) if a custom cache isn't passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants