mirror of https://github.com/sveltejs/svelte
fix: ensure reactions are kept dirty when marking them again (#11364)
previously a reaction could be marked as DIRTY and subsequently as MAYBE_DIRTY before running, resulting in false negatives. Ensure that DIRTY flag can never be lowered to MAYBE_DIRTY fixes #11363pull/11381/head
parent
7a3ee6d059
commit
de315d84eb
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: ensure reactions are kept dirty when marking them again
|
@ -0,0 +1,8 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
async test({ assert, target }) {
|
||||
await target.querySelector('button')?.click();
|
||||
assert.htmlEqual(target.innerHTML, `<button>0</button>`);
|
||||
}
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
let x = $state(1);
|
||||
let y = $state(1);
|
||||
let z = $derived(x*y);
|
||||
</script>
|
||||
|
||||
<button onclick={() => {
|
||||
x = 0;
|
||||
// reading a derived value and then setting another source contributing to the derived
|
||||
// resulting in the same value should not prevent pending render effects from updating
|
||||
z;
|
||||
y = 0;
|
||||
}}>{z}</button>
|
Loading…
Reference in new issue