mirror of https://github.com/sveltejs/svelte
fix: prevent ownership warnings if the fallback of a bindable is used (#15720)
* fix: prevent ownership warnings if the fallback of a bindable is used * fix: filter out symbol from own keys * fix: don't create sources for `BINDABLE_FALLBACK_SYMBOL` * fix: use strategy suggested by actually competent person aka @dummdidumm * chore: rename functionpull/15726/head
parent
475b5dbe83
commit
6c97a78049
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: prevent ownership warnings if the fallback of a bindable is used
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
const { test = $bindable() } = $props();
|
||||
</script>
|
||||
|
||||
{test}
|
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
import Child from './Child.svelte';
|
||||
|
||||
let { test = $bindable({}) } = $props();
|
||||
</script>
|
||||
|
||||
<Child bind:test />
|
@ -0,0 +1,11 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
mode: ['client'],
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
async test({ warnings, assert }) {
|
||||
assert.deepEqual(warnings, []);
|
||||
}
|
||||
});
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
import Parent from './Parent.svelte';
|
||||
</script>
|
||||
|
||||
<Parent />
|
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
let { test = $bindable({}) } = $props();
|
||||
</script>
|
||||
|
||||
<button onclick={()=>test = {}}></button>
|
||||
<button onclick={()=>test.test = {}}></button>
|
||||
|
||||
{test}
|
@ -0,0 +1,23 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
mode: ['client'],
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
async test({ warnings, assert, target }) {
|
||||
const [btn, btn2] = target.querySelectorAll('button');
|
||||
flushSync(() => {
|
||||
btn2.click();
|
||||
});
|
||||
assert.deepEqual(warnings, []);
|
||||
flushSync(() => {
|
||||
btn.click();
|
||||
});
|
||||
flushSync(() => {
|
||||
btn2.click();
|
||||
});
|
||||
assert.deepEqual(warnings, []);
|
||||
}
|
||||
});
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
import Parent from './Parent.svelte';
|
||||
</script>
|
||||
|
||||
<Parent />
|
Loading…
Reference in new issue