mirror of https://github.com/sveltejs/svelte
parent
68cffa8489
commit
c0842d1459
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: properly add owners to function bindings
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
let { arr = $bindable() } = $props();
|
||||
</script>
|
||||
|
||||
<button onclick={() => arr.push(arr.length)}></button>
|
@ -0,0 +1,20 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
test({ target, warnings, assert }) {
|
||||
const btn = target.querySelector('button');
|
||||
flushSync(() => {
|
||||
btn?.click();
|
||||
});
|
||||
assert.deepEqual(warnings, []);
|
||||
|
||||
flushSync(() => {
|
||||
btn?.click();
|
||||
});
|
||||
assert.deepEqual(warnings, []);
|
||||
}
|
||||
});
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import Child from './Child.svelte';
|
||||
|
||||
let arr = $state([]);
|
||||
let arr2 = $state([]);
|
||||
|
||||
let len = $derived(arr.length + arr2.length);
|
||||
</script>
|
||||
|
||||
<Child bind:arr={() => len % 2 === 0 ? arr : arr2, (v) => {}} />
|
Loading…
Reference in new issue