mirror of https://github.com/sveltejs/svelte
fix: ensure $inspect works with SvelteMap and SvelteSet (#12994)
* fix: ensure $inspect works with SvelteMap and SvelteSet * build * dev only * dev only * lint * lint * lint * alternative * Update packages/svelte/src/reactivity/map.js --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/13008/head
parent
29f29878c3
commit
21081d0fa5
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: ensure $inspect works with SvelteMap and SvelteSet
|
@ -0,0 +1,26 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
|
||||
async test({ assert, target, logs }) {
|
||||
const [btn, btn2] = target.querySelectorAll('button');
|
||||
btn.click();
|
||||
btn2.click();
|
||||
flushSync();
|
||||
|
||||
assert.deepEqual(logs, [
|
||||
'init',
|
||||
new Map(),
|
||||
'init',
|
||||
new Set(),
|
||||
'update',
|
||||
new Map([['a', 'a']]),
|
||||
'update',
|
||||
new Set(['a'])
|
||||
]);
|
||||
}
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
<script>
|
||||
import { SvelteMap, SvelteSet } from 'svelte/reactivity';
|
||||
|
||||
let map = new SvelteMap();
|
||||
let set = new SvelteSet();
|
||||
|
||||
$inspect(map);
|
||||
$inspect(set);
|
||||
</script>
|
||||
|
||||
<button onclick={() => map.set('a', 'a')}>Map</button>
|
||||
<button onclick={() => set.add('a')}>Set</button>
|
Loading…
Reference in new issue