diff --git a/src/primitives/map.ts b/src/primitives/map.ts index 066a999..5dad11f 100644 --- a/src/primitives/map.ts +++ b/src/primitives/map.ts @@ -59,6 +59,7 @@ export class SignaledMap extends Map { } get(key: K): V | undefined { + track(key, this.valuesCache); return super.get(key); } @@ -100,7 +101,6 @@ export class SignaledMap extends Map { batch(() => { dirtyAll(this.keysCache); dirtyAll(this.valuesCache); - dirty(OBJECT_KEYS, this.keysCache); }); } } diff --git a/src/primitives/set.ts b/src/primitives/set.ts index 6983487..2759f83 100644 --- a/src/primitives/set.ts +++ b/src/primitives/set.ts @@ -11,15 +11,15 @@ export class SignaledSet extends Set { if (values) for (const v of values) super.add(v); } + [Symbol.iterator](): IterableIterator { + return this.values(); + } + get size(): number { track(OBJECT_KEYS, this.valuesCache); return super.size; } - [Symbol.iterator](): IterableIterator { - return this.values(); - } - keys(): IterableIterator { return this.values(); } @@ -80,7 +80,6 @@ export class SignaledSet extends Set { super.clear(); batch(() => { dirtyAll(this.valuesCache); - dirty(OBJECT_KEYS, this.valuesCache); }); } }