mirror of https://github.com/sveltejs/svelte
fix: ensure reactions are correctly attached for unowned deriveds (#15158)
* fix: ensure reactions are correctly attached for unowned deriveds * tunepull/15156/head
parent
970aa7cfaa
commit
7bef5963bd
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: ensure reactions are correctly attached for unowned deriveds
|
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
let { value = $bindable() } = $props()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={() => value = 'a'}>change</button>
|
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
let {disabled = false} = $props()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{disabled}
|
@ -0,0 +1,16 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
async test({ assert, target }) {
|
||||||
|
let [btn1, btn2] = target.querySelectorAll('button');
|
||||||
|
|
||||||
|
btn1?.click();
|
||||||
|
flushSync();
|
||||||
|
|
||||||
|
btn2?.click();
|
||||||
|
flushSync();
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `<button>change</button><button>change</button>\nfalse`);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,11 @@
|
|||||||
|
<script>
|
||||||
|
import Child2 from './Child2.svelte'
|
||||||
|
import Child from './Child.svelte'
|
||||||
|
let loginname = $state('')
|
||||||
|
let password = $state('')
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Child bind:value={loginname} />
|
||||||
|
<Child bind:value={password} />
|
||||||
|
<Child2 disabled={!loginname || !password} />
|
||||||
|
|
Loading…
Reference in new issue