New style blocks should inject after the last one
See original GitHub issueCurrently when rendering in the browser, style blocks are automatically appended to the end of the <head>
tag: https://github.com/styled-components/styled-components/blob/master/src/models/BrowserStyleSheet.js#L169
We should revise this behavior to instead grab a reference to the last known styled-components style block and inject after that, wherever it is in the DOM (falling back to document.head
if it’s the first one.)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top Results From Across the Web
after - CSS: Cascading Style Sheets - MDN Web Docs - Mozilla
In CSS, ::after creates a pseudo-element that is the last child of the selected element. It is often used to add cosmetic content...
Read more >Common Patient Questions about Nerve Blocks
This depends on the type of block performed and the type of numbing medication used. For example, nerve blocks for hand surgery usually...
Read more >Injection Options | Blockly - Google Developers
Name Type Description
sounds boolean If false , disables sounds. Defaults to true .
zoom object Configures zooming behaviour. See Zoom.
Read more >Occipital nerve block injection - Mayfield Clinic
An occipital nerve block injection can help relieve headache and ... Occipital injections work best when the typical pattern is one-sided head pain ......
Read more >Questions About Nerve Blocks | Regional Anesthesia
This depends on the type of block performed and the type of numbing medication used. For example, nerve blocks for hand surgery usually...
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 Free
Top 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
I would be happy to pick this up as a first contribution, is it still valid?
Like what happens if we don’t do the above?
The
#1
case I can think of is if you are using SSR and extract the critical CSS but place it in<body>
instead of<head>
. When styled-components takes over upon rehydration, any additional styles are injected to the default location (<head>
) and then if any of those styles are building off the critical CSS, they’ll be out of order and manifest all sorts of bugs.