From 5f97a11219ef1861e1052bb5227dde6b25c8ad45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kwa=C5=9Bniak?= Date: Thu, 28 Mar 2024 00:21:07 +0100 Subject: [PATCH] Fix get() --- src/primitives/map.ts | 2 +- src/primitives/set.ts | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) 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); }); } }