mirror of https://github.com/sveltejs/svelte
fix: prevent migrated snippet from shadow snippet prop (#14127)
parent
74a2c6b580
commit
8de5605b6a
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: prevent migrated snippet from shadow snippet prop
|
@ -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>
|
@ -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>
|
Loading…
Reference in new issue