Skip to content

[🐞] CSS is being included multiple times on the page #296

@cmbartschat

Description

@cmbartschat

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

  • Open the link
  • npm run preview
  • Inspect the section elements
  • See that there are two css rules that target it

image

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    @builder.io/qwik: ^0.100.0 => 0.100.0 
    @builder.io/qwik-city: ^0.100.0 => 0.100.0 
    undici: 5.21.0 => 5.21.0 
    vite: 4.2.1 => 4.2.1 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions