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

Styles being rendered in duplicate #501

Closed
ivoreis opened this issue Dec 23, 2016 · 5 comments
Closed

Styles being rendered in duplicate #501

ivoreis opened this issue Dec 23, 2016 · 5 comments
Assignees
Labels
Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).

Comments

@ivoreis
Copy link

ivoreis commented Dec 23, 2016

Hi,

Running the example, using a custom Document (with-styled-components) I noticed that the stylesheets are being added in duplicate to the page.

Apparently flushing the stylesheets like we're doing here avoids this issue but raises a total different one (FOUC).

Any idea why the stylesheets are being added more than once and any tip how to avoid this?

@nkzawa
Copy link
Contributor

nkzawa commented Dec 25, 2016

Basically, styled-components doesn't officially support SSR yet. I'm not sure if we can avoid this.

styled-components/styled-components#124

@nkzawa nkzawa added Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.). Status: Help Wanted labels Dec 25, 2016
@bnjmnt4n
Copy link

bnjmnt4n commented Jan 4, 2017

Based on my experience, the stylesheets are added more than once only when on dev mode, when hot reloading is enabled. Apart from that, I haven't encountered this issue elsewhere, so this issue isn't that serious, although it can still cause problems.

@timneutkens
Copy link
Member

@nkzawa I guess this is fixed by #668, might have to update the example.

@nkzawa
Copy link
Contributor

nkzawa commented Jan 7, 2017

@timneutkens it doesn't fix the issue since styles of styled-components are not rendered by next/head.

@timneutkens
Copy link
Member

Styled-components has released a v2 branch under 2.0.0 which is currently in pre-release
try npm install styled-components@2.0.0-4

It has better server rendering support. @ivoreis could you try to implement it?

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).
Projects
None yet
Development

No branches or pull requests

4 participants