Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed issue with .has() when new value is added and then deleted or c… #981

Merged
merged 9 commits into from
Oct 27, 2024
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
overthemike marked this conversation as resolved.
Show resolved Hide resolved
return exists
overthemike marked this conversation as resolved.
Show resolved Hide resolved
},
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