You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a <style> tag is (either directly or indirectly) referenced by both app.tsx and routes/a.tsx, but not referenced by routes/b.tsx, it will be removed when navigating from /a to /b.
I think this only happens in dev mode, because prod mode has a different style injection method.
Recording.2024-03-19.210830.mp4
Expected behavior 🤔
The <style> tag keeps there because app.tsx still requires it.
Steps to reproduce 🕹
Steps:
Create a new Solid Start project using basic tempate
This is similar to #1191, although that issue might be caused by their specific configuration, the underlying problem truly exists.
It's not uncommon that the shell layout and some page both reference the same style, for example they both use a <Button> component which imports button.css.
If another page doesn't use that <Button> component, this <style> tag will be removed when navigating to that page, causing bad developer experiences.
Hi, I am experiencing the same issue and can still reproduce using the repository in the comment above, even with up-to-date dependencies. Can somebody reopen this issue, or should I create a new issue entirely?
Duplicates
Latest version
Current behavior 😯
If a
<style>
tag is (either directly or indirectly) referenced by bothapp.tsx
androutes/a.tsx
, but not referenced byroutes/b.tsx
, it will be removed when navigating from/a
to/b
.I think this only happens in dev mode, because prod mode has a different style injection method.
Recording.2024-03-19.210830.mp4
Expected behavior 🤔
The
<style>
tag keeps there becauseapp.tsx
still requires it.Steps to reproduce 🕹
Steps:
basic
tempate<Counter/>
to somewhere inapp.tsx
pnpm dev
Observation: the counter button loses its styling
Full repro: https://github.com/yume-chan/style-removed
Context 🔦
This is similar to #1191, although that issue might be caused by their specific configuration, the underlying problem truly exists.
It's not uncommon that the shell layout and some page both reference the same style, for example they both use a
<Button>
component which importsbutton.css
.If another page doesn't use that
<Button>
component, this<style>
tag will be removed when navigating to that page, causing bad developer experiences.The root cause might lay in
vinxi
, the style runtime might need to count the references to each style, and only remove them when not used. https://github.com/nksaraf/vinxi/blob/main/packages/vinxi/runtime/style.jsYour environment 🌎
The text was updated successfully, but these errors were encountered: