mirror of https://github.com/sveltejs/svelte
fix: prevent false positive ownership warning (#11490)
fixes #11483 We need to keep track of the component function similar to how we keep track of the component context, so that effects etc have the correct one associatedpull/11474/head
parent
3e1f82b8c4
commit
d86b05279f
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: prevent false positive ownership warning
|
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
let { object = $bindable() } = $props();
|
||||
</script>
|
||||
|
||||
<button onclick={() => object.count += 1}>
|
||||
clicks: {object.count}
|
||||
</button>
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
let { children } = $props();
|
||||
</script>
|
||||
|
||||
{@render children?.()}
|
@ -0,0 +1,11 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: `<button>clicks: 0</button>`,
|
||||
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
|
||||
warnings: []
|
||||
});
|
@ -0,0 +1,14 @@
|
||||
<script>
|
||||
import Outer from './Outer.svelte';
|
||||
import Inner from './Inner.svelte';
|
||||
|
||||
let object = $state({ count: 0 });
|
||||
let test = $state(true);
|
||||
</script>
|
||||
|
||||
<Outer>
|
||||
<!-- check that render effects inside slotted content doesn't mess with ownership validation -->
|
||||
{#if test}
|
||||
<Inner bind:object />
|
||||
{/if}
|
||||
</Outer>
|
Loading…
Reference in new issue