MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / StoreNodeMap

Class StoreNodeMap

packages/frontend/src/decode.ts:13–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11import {batch, createSignal} from 'solid-js'
12
13export class StoreNodeMap {
14 map = new Map<NodeID, {node: DecodedValue<ValueType.Store>; refs: number}>()
15 get(id: NodeID): DecodedValue<ValueType.Store> | null {
16 return this.map.get(id)?.node || null
17 }
18 addRef(id: NodeID, node: DecodedValue<ValueType.Store>) {
19 const entry = this.map.get(id)
20 if (entry) entry.refs++
21 else this.map.set(id, {node, refs: 1})
22 }
23 removeRef(id: NodeID) {
24 const entry = this.map.get(id)
25 if (entry) {
26 entry.refs--
27 if (entry.refs === 0) {
28 this.map.delete(id)
29 }
30 }
31 }
32 clear() {
33 this.map.clear()
34 }
35}
36
37export type ObjectValueData = {
38 readonly value: Record<string | number, DecodedValue> | DecodedValue[] | null

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…