mirror of https://github.com/sveltejs/svelte
fix: falsy attachments on components (#16021)
* fix: falsy attachments on components * skip the noop if known to be a function --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/16023/head
parent
d4af83a058
commit
6351288c7b
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: falsy attachments on components
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
let props = $props();
|
||||
</script>
|
||||
|
||||
<div {...props}></div>
|
@ -0,0 +1,5 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
test() {}
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
import Child from './Child.svelte';
|
||||
|
||||
function attachment(){
|
||||
console.log("up");
|
||||
}
|
||||
|
||||
let enabled = $state(false);
|
||||
</script>
|
||||
|
||||
<button onclick={() => enabled = !enabled}></button>
|
||||
|
||||
<Child {@attach enabled && attachment} />
|
Loading…
Reference in new issue