fix: populate `this.#sources` when constructing reactive map

pull/11915/head
Rich Harris 2 years ago
parent 862949d22a
commit 52a756550d

@ -2,4 +2,4 @@
'svelte': patch
---
fix: increment version when creating new source in Map.get or Map.has
fix: populate `this.#sources` when constructing reactive map

@ -24,7 +24,9 @@ export class ReactiveMap extends Map {
if (DEV) new Map(value);
if (value) {
var sources = this.#sources;
for (var [key, v] of value) {
sources.set(key, source(Symbol()));
super.set(key, v);
}
this.#size.v = super.size;
@ -45,7 +47,6 @@ export class ReactiveMap extends Map {
if (ret !== undefined) {
s = source(Symbol());
sources.set(key, s);
this.#increment_version();
} else {
// We should always track the version in case
// the Set ever gets this value in the future.
@ -78,7 +79,6 @@ export class ReactiveMap extends Map {
if (ret !== undefined) {
s = source(Symbol());
sources.set(key, s);
this.#increment_version();
} else {
// We should always track the version in case
// the Set ever gets this value in the future.

Loading…
Cancel
Save