Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS imported into (solid) islands is not loaded on subsequent page loads when using view transitions and client:only in dev #10466

Closed
1 task
knpwrs opened this issue Mar 17, 2024 · 2 comments · Fixed by #10532
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: view transitions Related to the View Transitions feature (scope)

Comments

@knpwrs
Copy link
Contributor

knpwrs commented Mar 17, 2024

Astro Info

Astro                    v4.5.5
Node                     v20.10.0
System                   macOS (arm64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/node
Integrations             @astrojs/tailwind
                         @astrojs/solid-js
                         @astrojs/mdx
                         @sentry/astro

If this issue only occurs in one browser, which browser is a problem?

I have seen this happen in both Chrome and Firefox.

Describe the Bug

When importing CSS into a solid island (may be other islands too, I haven't tested other frameworks), the CSS loads fine on the initial page load, but when you navigate away and come back (with view transitions) the CSS is not loaded properly and the page looks broken.

This only appears to affect client:only (at least when using client:visible the CSS always loads correctly).

The included example sets builds on the official solid example. Click on the Another page link and then click the Counter link.

The fix is to move the CSS import from Counter.tsx to index.astro, then the CSS is always loaded properly under every circumstance, including with view transitions and client:only.

What's the expected result?

CSS imported in islands should load properly when navigating around the site using view transitions and client:only.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-eqw3jl?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Mar 17, 2024
@Princesseuh
Copy link
Member

cc @martrapp

This only seems to affect the dev server, probably because of how Vite injects the CSS with a wonky link in the head, not sure.

@Princesseuh Princesseuh added - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged labels Mar 18, 2024
@Princesseuh Princesseuh changed the title CSS imported into (solid) islands is not loaded on subsequent page loads when using view transitions and client:only CSS imported into (solid) islands is not loaded on subsequent page loads when using view transitions and client:only in dev Mar 18, 2024
@martrapp
Copy link
Member

I'm away from keyboard this week ;-)
The client-side router got special support for client:only styles some month ago.
This may be a degression from recent changes or solid specific.
Can look deeper into this at the end of the week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: view transitions Related to the View Transitions feature (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants