question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicated SSR styles in _document

See original GitHub issue

This can be checked by doing a quick search in the source code of https://primer.style/components for <style id="emotion-static"> or <style data-styled-components="jxlxdj dvAJpH kOFOVP eGjeoI dqzKnc fGWUSs">

It might be due to returning styles props for SSR styles.

https://github.com/primer/components/blob/c723850e2c5b7b7435653f3404c175783d9f44a6/pages/_document.js#L14

we don’t really need to render them in the <Head>

https://github.com/primer/components/blob/c723850e2c5b7b7435653f3404c175783d9f44a6/pages/_document.js#L51

as this is causing the duplication.

This could be fixed by either removing {styles} in the in the <Head> o renaming the props to other term, such as styleTags

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
emplumscommented, Nov 15, 2018

Hey @matallo thanks for pointing this out, it was actually on my list of things to check out this week 🙈 I tried your suggestion and it worked! It looks like the official documentation also suggests using something other than styles for the name as well.

2reactions
matallocommented, Nov 15, 2018

I might not have explained myself well: in both cases the CSS is rendered statically but when passing the style tags with the styles props name they get repeated (search for occurrences of the strings above in the source code of the page).

Read more comments on GitHub >

github_iconTop Results From Across the Web

SSR duplicates stylesheets on refresh · Issue #1890 - GitHub
What we've found is that sheet.collectStyles will append a duplicate set of styles on subsequent calls. I've attached a screenshot of what ...
Read more >
Styled Components with SSR duplicating CSS code in JS files
I have a custom server with a HoC that wraps styled in a monorepo. withstyles.js import styled from 'styled-components'; export default ...
Read more >
SSR + CSS Class Names Duplicated? - The Berryware Blog
I first started with NextJS and tried to get Styled Components working with it and Storybook. After running into too many problems I...
Read more >
SSRS template to use with “Copy Report Style” to duplicate ...
I have used >Epicor10 >Report Style Maintenance >Actions >Copy Report Style to make a new formatted ARForm (invoice) report in SSRS Report ...
Read more >
Duplicating Styles without Dependency - Microsoft Word Tips
I found a simpler solution that foregoes the Organizer. 1. Create the two styles in the original document. 2. Copy some text with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found