mirror of https://github.com/sveltejs/svelte
parent
8860ca6c1d
commit
210d127deb
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: don't mark deriveds as clean if updating during teardown
|
@ -0,0 +1,22 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
import { flushSync } from 'svelte';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: `<button>toggle (false)</button>`,
|
||||||
|
|
||||||
|
async test({ assert, target, logs }) {
|
||||||
|
assert.deepEqual(logs, ['up', { foo: false, bar: false }]);
|
||||||
|
|
||||||
|
const button = target.querySelector('button');
|
||||||
|
|
||||||
|
flushSync(() => button?.click());
|
||||||
|
assert.deepEqual(logs, [
|
||||||
|
'up',
|
||||||
|
{ foo: false, bar: false },
|
||||||
|
'down',
|
||||||
|
{ foo: false, bar: false },
|
||||||
|
'up',
|
||||||
|
{ foo: true, bar: true }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,14 @@
|
|||||||
|
<script>
|
||||||
|
let foo = $state(false)
|
||||||
|
let bar = $derived(foo)
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
console.log('up', { foo, bar });
|
||||||
|
|
||||||
|
return () =>{
|
||||||
|
console.log('down', { foo, bar });
|
||||||
|
};
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={() => foo = !foo}>toggle ({foo})</button>
|
Loading…
Reference in new issue