Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Nested components are losing styles when enclosed in {#if}{/if} - 5.26.0 regression | GoodFirstPicks

Nested components are losing styles when enclosed in {#if}{/if} - 5.26.0 regression

sveltejs/svelte 2 comments 1mo ago
View on GitHub
highopenScope: somewhat clearSkill match: noSvelteTypeScript

Why this is a good first issue

Issue involves complex Astro+Svelte interaction with hydration and SSR.

AI Summary

The issue describes nested Svelte components losing styles when enclosed in {#if} blocks in an Astro+Svelte setup with hydration enabled. The problem appears to be specific to Astro's handling of Svelte components and SSR, making it difficult to isolate and reproduce in a pure Svelte context. The issue seems to have been addressed in Astro, reducing its urgency.

Issue Description

Describe the bug

This bug is present with Astro+Svelte combination, and unfortunately, I don't know if this can be reproduced with Svelte only.

This issue on Astro repo: https://github.com/withastro/astro/issues/14252 The bug appeared in Svelte 5.26.0 and further on, 5.25.12 is unaffected.

Conditions: Astro v5.13.2, Svelte 5.38.2 Astro component must include Svelte component with hydration enabled (this means both SSR and normal compilation):

page.astro:

--
import Component1 from "./Component1.svelte";
--
<Component1 client:idle />

Component1.svelte:

<script>
import NestedComponent from "NestedComponent.svelte";
</script>
{#if true}
    <NestedComponent  /> <!-- This one loses all styles! -->
{/if}

Reproduction

https://stackblitz.com/github/M4R7iNP/astrobugtest?file=README.md

Logs

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (12) x64 AMD Ryzen 5 5600H with Radeon Graphics
    Memory: 36.42 GB / 63.86 GB
  Binaries:
    Node: 20.18.1 - C:\Program Files\nodejs\node.EXE
    npm: 11.6.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (140.0.3485.81)
    Internet Explorer: 11.0.26100.1882

Severity

annoyance

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!

Risk Flags

  • Astro-specific
  • hydration-related
  • SSR context
Loading labels...

Details

Points10 pts
Difficultyhigh
Scopesomewhat clear
Skill Matchno
Test Focusedunclear