mirror of https://github.com/sveltejs/svelte
fix: properly validate snippet/slot interop (#12421)
The previous validation for checking if slots with let directives were rendered with `{@render children(...)}` had false positives - threw an error even if the other side didn't make use of the arguments, i.e. wasn't actually using a let directive - didn't check that the rendered snippet actually was the children property This fixes the validation by only applying it to children render tags, and by adding the slot to `$$slots.default` instead of `$$props.children` in more cases (when it's using `<svelte:fragment>` or `let:` directives, which both mean you're using old slot syntax) Fixes #12414pull/12408/head
parent
70cec4e40e
commit
51f12d243d
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: properly validate snippet/slot interop
|
@ -0,0 +1,7 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
compileOptions: {
|
||||||
|
dev: true
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
let { children } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{@render children(true)}
|
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
import Inner from './inner.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Inner>I don't need to use the argument if I don't want to</Inner>
|
Loading…
Reference in new issue