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

Named slot interop with snippet prop + @render #13784

Closed
brunnerh opened this issue Oct 22, 2024 · 3 comments · Fixed by #13869
Closed

Named slot interop with snippet prop + @render #13784

brunnerh opened this issue Oct 22, 2024 · 3 comments · Fixed by #13869

Comments

@brunnerh
Copy link
Member

brunnerh commented Oct 22, 2024

Describe the bug

There were some interop limitations between slots & snippets which by now have been addressed for the most part, so this probably should be fixed as well, if possible.

Would obsolete #13063 since everything would be fully compatible as far as I can tell.

Reproduction

<h2>WithSnippet - Fragments</h2>
<WithSnippet>
	<svelte:fragment>
		Fragment content
	</svelte:fragment>
	<svelte:fragment slot="stuff">
		Fragment content
	</svelte:fragment>
</WithSnippet>

<h2>WithSnippet - Elements</h2>
<WithSnippet>
	<span>Element content</span>
	<span slot="stuff">
		Element content
	</span>
</WithSnippet>
<!-- WithSnippet.svelte -->
<script>
	const { stuff, children } = $props();
</script>

{#if children}
	<p>Default: {@render children()}</p>
{:else}
	<p style:color=red>Default slot snippet is undefined</p>
{/if}

{#if stuff}
	<p>Named: {@render stuff()}</p>
{:else}
	<p style:color=red>Named slot snippet is undefined</p>
{/if}

REPL

Logs

No response

System Info

REPL

Severity

blocking an upgrade

@brunnerh brunnerh changed the title Named slot interop with @render Named slot interop with snippet prop + @render Oct 22, 2024
@paoloricciuti
Copy link
Member

@adiguba
Copy link
Contributor

adiguba commented Oct 22, 2024

We already bail out in the migration script if that's the case

Yes but conflits are possible if the component was not migrated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants