Skip to content

Commit

Permalink
fixed issue with .has() when new value is added and then deleted or c…
Browse files Browse the repository at this point in the history
…leared
  • Loading branch information
overthemike committed Oct 23, 2024
1 parent 552992c commit 2d3714c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/vanilla/utils/proxyMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,8 @@ export function proxyMap<K, V>(entries?: Iterable<[K, V]> | undefined | null) {
has(key: K) {
const map = getMapForThis(this)
const exists = map.has(key)
if (!exists) {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
this.index // touch property for tracking
}
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
this.data.length // touch property for tracking
return exists
},
set(key: K, value: V) {
Expand Down
6 changes: 2 additions & 4 deletions src/vanilla/utils/proxySet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ export function proxySet<T>(initialValues?: Iterable<T> | null) {
const map = getMapForThis(this)
const v = maybeProxify(value)
const exists = map.has(v)
if (!exists) {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
this.index // touch property for tracking
}
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
this.data.length // touch property for tracking
return exists
},
add(value: T) {
Expand Down

0 comments on commit 2d3714c

Please sign in to comment.