[🐞] CSS is being included multiple times on the page #297
Replies: 7 comments
-
|
Beta Was this translation helpful? Give feedback.
-
Hi @cmbartschat |
Beta Was this translation helpful? Give feedback.
-
Hello @cmbartschat. Please provide the missing information requested above. |
Beta Was this translation helpful? Give feedback.
-
The CSS is included twice because you include it twice in two different components. Although probably the css import should result in the same css qrl somehow. |
Beta Was this translation helpful? Give feedback.
-
Here's a repro with the latest qwik.new We still see the duplicated styles: The problem goes away if I switch to a shared hook like:
|
Beta Was this translation helpful? Give feedback.
-
We moved this issue to |
Beta Was this translation helpful? Give feedback.
-
So I think we should change the optimizer because right now it is using the location of the line for the hash of the QRL and instead it should use the location of the variable that it is wrapping. So in that case this import would always have the same hash and it would only be included once. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Which component is affected?
Qwik Runtime
Describe the bug
The same CSS file is being inlined multiple times.
I have two separate components including the same style.css with
useStyles$
. If I render the same component multiple times, the css file is only included once, but with multiple components, there are duplicate<style>
elements inserted.Reproduction
https://stackblitz.com/edit/qwik-starter-yaczdi
Steps to reproduce
npm run preview
section
elementsSystem Info
Beta Was this translation helpful? Give feedback.
All reactions