mirror of https://github.com/sveltejs/svelte
fix: @debug does not work with proxied-state (#13690)
* fix: @debug must use $state.snapshot() on value * changeset * add test --------- Co-authored-by: Dominic Gannaway <dg@domgan.com>pull/13752/head
parent
28c8d2b95d
commit
ad578a5da5
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: @debug does not work with proxied-state
|
@ -0,0 +1,22 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
compileOptions: {
|
||||||
|
dev: true
|
||||||
|
},
|
||||||
|
|
||||||
|
test({ assert, target, logs }) {
|
||||||
|
const b1 = target.querySelector('button');
|
||||||
|
b1?.click();
|
||||||
|
flushSync();
|
||||||
|
b1?.click();
|
||||||
|
flushSync();
|
||||||
|
|
||||||
|
assert.deepEqual(logs, [
|
||||||
|
{ count: { current: 0 } },
|
||||||
|
{ count: { current: 1 } },
|
||||||
|
{ count: { current: 2 } }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
let count = $state({ current: 0 });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{@debug count}
|
||||||
|
|
||||||
|
<button onclick={()=> count.current++}>+</button>
|
Loading…
Reference in new issue