-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent migrated snippet from shadow snippet prop
- Loading branch information
1 parent
8d0937a
commit 06593a0
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: prevent migrated snippet from shadow snippet prop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/svelte/tests/migrate/samples/shadowed-forwarded-slot/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{#if $$slots.label} | ||
<slot name="label" /> | ||
{/if} | ||
<MyInput> | ||
<slot name="label" slot="label"/> | ||
</MyInput> | ||
<MyInput> | ||
<div slot="label"> | ||
<MyComponent> | ||
<div slot="label"> | ||
<slot name="label" /> | ||
</div> | ||
</MyComponent> | ||
</div> | ||
</MyInput> |
33 changes: 33 additions & 0 deletions
33
packages/svelte/tests/migrate/samples/shadowed-forwarded-slot/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script> | ||
/** | ||
* @typedef {Object} Props | ||
* @property {import('svelte').Snippet} [label] | ||
*/ | ||
/** @type {Props} */ | ||
let { label } = $props(); | ||
const label_render = $derived(label); | ||
</script> | ||
|
||
{#if label} | ||
{@render label?.()} | ||
{/if} | ||
<MyInput> | ||
{#snippet label()} | ||
{@render label_render?.()} | ||
{/snippet} | ||
</MyInput> | ||
<MyInput> | ||
{#snippet label()} | ||
<div > | ||
<MyComponent> | ||
{#snippet label()} | ||
<div > | ||
{@render label_render?.()} | ||
</div> | ||
{/snippet} | ||
</MyComponent> | ||
</div> | ||
{/snippet} | ||
</MyInput> |