Skip to content

Commit be3b08c

Browse files
committed
fix
1 parent 9be0fdd commit be3b08c

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

packages/svelte/src/internal/client/render.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ export function set_text(dom, value) {
6969
* @param {null | ((anchor: Comment) => void)} fallback_fn
7070
*/
7171
export function slot(anchor, $$props, slot_name, slot_props, fallback_fn) {
72+
var is_snippet = false;
7273
var slot_fn = $$props.$$slots?.[slot_name];
7374
if (slot_fn === true) {
7475
if (slot_name === 'default') {
7576
slot_fn = $$props.children;
7677
} else {
78+
is_snippet = true;
7779
slot_fn = $$props[slot_name];
7880
}
7981
}
@@ -83,7 +85,7 @@ export function slot(anchor, $$props, slot_name, slot_props, fallback_fn) {
8385
fallback_fn(anchor);
8486
}
8587
} else {
86-
slot_fn(anchor, slot_props);
88+
slot_fn(anchor, is_snippet ? () => slot_props : slot_props);
8789
}
8890
}
8991

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<p><slot /></p>
2-
<p><slot name="named" /></p>
2+
<p><slot name="named" foo="foo" /></p>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test } from '../../test';
22

33
export default test({
4-
html: `<p>Default</p> <p>Named</p>`
4+
html: `<p>Default</p> <p>Named foo</p>`
55
});

packages/svelte/tests/runtime-runes/samples/snippet-slot-interop/main.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<Child>
66
Default
7-
{#snippet named()}
8-
Named
7+
{#snippet named({ foo })}
8+
Named {foo}
99
{/snippet}
1010
</Child>

0 commit comments

Comments
 (0)