mirror of https://github.com/sveltejs/svelte
fix: tag stores for `$inspect.trace()` (#16452)
parent
dd55de3b75
commit
5033c8e965
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: tag stores for `$inspect.trace()`
|
@ -0,0 +1,30 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
import { normalise_trace_logs } from '../../../helpers.js';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
compileOptions: {
|
||||||
|
dev: true
|
||||||
|
},
|
||||||
|
|
||||||
|
test({ assert, target, logs }) {
|
||||||
|
assert.deepEqual(normalise_trace_logs(logs), [
|
||||||
|
{ log: 'effect' },
|
||||||
|
{ log: 'store', highlighted: true },
|
||||||
|
{ log: '$count', highlighted: false },
|
||||||
|
{ log: 0 }
|
||||||
|
]);
|
||||||
|
|
||||||
|
logs.length = 0;
|
||||||
|
|
||||||
|
const [button] = target.querySelectorAll('button');
|
||||||
|
flushSync(() => button.click());
|
||||||
|
|
||||||
|
assert.deepEqual(normalise_trace_logs(logs), [
|
||||||
|
{ log: 'effect' },
|
||||||
|
{ log: 'store', highlighted: true },
|
||||||
|
{ log: '$count', highlighted: false },
|
||||||
|
{ log: 1 }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,14 @@
|
|||||||
|
<script>
|
||||||
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
|
const count = writable(0);
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
$inspect.trace('effect');
|
||||||
|
$count;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={() => $count += 1}>
|
||||||
|
clicks: {$count}
|
||||||
|
</button>
|
Loading…
Reference in new issue