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

Different classes on server and client when using css prop #2538

Closed
th0th opened this issue May 10, 2019 · 7 comments
Closed

Different classes on server and client when using css prop #2538

th0th opened this issue May 10, 2019 · 7 comments
Labels
needs more info ✋ An issue that needs triaging and reproducible examples or more information to be resolved

Comments

@th0th
Copy link

th0th commented May 10, 2019

I get this warning when using styled-components 4.2.0 with next.js 8.

Warning: Prop className did not match. Server: "sc-cJSrbW kQAtac" Client: "sc-htoDjs iZPNuM"

The only step needed to reproduce is to add something like this in a page on the default next.js example:

<div
  css="margin-top: 20px;"
>
  Just some text
</div>

or

<div
  css={css`margin-top: 20px;`}
>
  Just some text
</div>

Here is a codesandbox:
https://codesandbox.io/embed/jlwvwyy0ow
https://jlwvwyy0ow.sse.codesandbox.io/

Annotation 2019-05-10 045959

@quantizor
Copy link
Contributor

There's something weird going on with nextjs in dev mode (I see this in my projects as well), but the issue does not go through to production in my experience.

@th0th
Copy link
Author

th0th commented May 11, 2019

Thanks for the reply @probablyup. So do you just ignore those warnings in development mode? The number of warnings goes up as I keep adding more css props and it is annoying :)

@quantizor
Copy link
Contributor

quantizor commented May 11, 2019 via email

@mxstbr
Copy link
Member

mxstbr commented May 11, 2019

/cc @timneutkens for visibility (not sure there's anything actionable for you to do here), this happens in my projects too.

@timneutkens
Copy link

We don't really do anything weird here, just webpack HMR and re-rendering. Could you file an issue on Next.js so that I can add labels for people to look into it.

@th0th
Copy link
Author

th0th commented May 13, 2019

@timneutkens Here it is: vercel/next.js#7322

@quantizor quantizor added needs more info ✋ An issue that needs triaging and reproducible examples or more information to be resolved integration labels May 31, 2019
@quantizor
Copy link
Contributor

@th0th this should be fixed with the latest babel plugin patch version, thanks for reporting! https://github.com/styled-components/babel-plugin-styled-components/releases/tag/v1.10.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info ✋ An issue that needs triaging and reproducible examples or more information to be resolved
Projects
None yet
Development

No branches or pull requests

4 participants