-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Description
Describe the bug
Svelte is not consistent with its rendering when dealing with Snippets, as component authors, shouldn't we be allowed to conditionally render Snippets? I feel like this is an error/bug and things like the below code should be possible:
<!-- Example.svelte -->
<script>
let { children } = $props()
</script>
<div>
{@render children()}
</div>
<!-- App.svelte -->
<Example>
{#if true} Even this is fine! {/if} <!-- This render -->
</Example>
<Example>
{#if true}
{#snippet children()}
Wait, what? Why I'm not fine? <!-- This do not render -->
{/snippet }
{/if}
</Example>
Reproduction
Logs
No response
System Info
System:
OS: Windows 11 10.0.22631
CPU: (8) x64 AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx
Memory: 2.84 GB / 9.88 GB
Binaries:
Node: 20.11.1 - C:\Program Files\nodejs\node.EXE
npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
bun: 1.1.3 - ~\.bun\bin\bun.EXE
Browsers:
Edge: Chromium (123.0.2420.81)
Internet Explorer: 11.0.22621.1
npmPackages:
svelte: 5.0.0-next.97 => 5.0.0-next.97
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels