Skip to content

Commit

Permalink
Merge branch 'keyed-collections-2' into keyed-collections
Browse files Browse the repository at this point in the history
  • Loading branch information
overthemike committed Oct 14, 2024
2 parents d213154 + db1fef6 commit 29f325e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/vanilla/utils/proxyMap-rawMap1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const isProxy = (x: any) => proxyStateMap.has(x)

type InternalProxyObject<K, V> = Map<K, V> & {
epoch: number
_registerSnap: boolean
toJSON: () => Map<K, V>
}

Expand All @@ -32,14 +33,18 @@ export function proxyMap<K, V>() {
)
}
snapMapCache.set(latestSnap, snapMap)
return true
}
return false
}
const getSnapMap = (x: any) => snapMapCache.get(x)

const vObject: InternalProxyObject<K, V> = {
epoch: 0,
get _registerSnap() {
return registerSnapMap()
},
get size() {
registerSnapMap()
const map = getSnapMap(this) || rawMap
return map.size
},
Expand Down

0 comments on commit 29f325e

Please sign in to comment.