Browser leaves duplicated style node when using ssr
See original GitHub issueCurrent behavior:
Hydrate will not de-dup
To reproduce:
Create a styled component and put into page:
const App = () => (
<Button />
<Button />
<Button />
<Button />
<Button />
);
Expected behavior:
It’s OK to get duplicated style definition on Server render:
But it should de-dup when hydrate on client side.
Environment information:
react
version: 17.0.2@emotion/react
version: 11.4.1
I think it may same as #2436
I guess hydrate logic do not dedup which makes too many same style keep in the page.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Why We're Breaking Up with CSS-in-JS
The ability to use JavaScript constants in styles reduces duplication in some cases, since the same constant does not have to be defined...
Read more >Duplicate style render on SSR
I'm currently developing CMS with Gatsby and emotion. Style is ... Here's rendered result on browser(CSS Style is literally duplicated).
Read more >Server-Side Rendering
Even though the demo illustrates the basic idea of SSR, it still leaves open questions: How to deal with styles? Node doesn't understand...
Read more >Keeping Server-Side Rendering Cool With React Hydration
The purpose of this article is to share some helpful things to keep in mind to render a seamless experience as a Server-Side...
Read more >Rendering on the Web
Where should we implement logic and rendering in our applications? Should we use Server Side Rendering? What about Rehydration?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Wrapping in CacheProvider has helped in my case:
We had this problem with @emotion/react v11.9.0 but it seems to fixed in v11.9.3.