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

Function map_source_value

packages/debugger/src/inspector/inspector.ts:211–245  ·  view source on GitHub ↗
(
    node_raw: Solid.SourceMapValue | Solid.Computation,
    handler:  (nodeId: NodeID, value: unknown) => void,
    ctx:      Inspector_Context<TEl>,
)

Source from the content-addressed store, hash-verified

209}
210
211function map_source_value<TEl extends object>(
212 node_raw: Solid.SourceMapValue | Solid.Computation,
213 handler: (nodeId: NodeID, value: unknown) => void,
214 ctx: Inspector_Context<TEl>,
215): Mapped.SourceValue | null {
216
217 let node = utils.getNode(node_raw)
218 let {value} = node_raw
219 let id: NodeID
220
221 // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
222 switch (node.kind) {
223 case NodeType.Memo: id = getSdtId(node.data, ObjectType.Owner) ;break
224 case NodeType.Signal: id = getSdtId(node.data, ObjectType.Signal) ;break
225 case NodeType.Store: id = getSdtId(node.data, ObjectType.Store) ;break
226 case NodeType.CustomValue: id = getSdtId(node.data, ObjectType.CustomValue) ;break
227 default:
228 return null
229 }
230
231 ctx.value_map.set(`${ValueItemType.Signal}:${id}`, value_node_make_obj(node_raw))
232
233 if (node.kind === NodeType.Memo ||
234 node.kind === NodeType.Signal
235 ) {
236 observeValueUpdate(node.data, v => handler(id, v), $INSPECTOR)
237 }
238
239 return {
240 type: node.kind,
241 name: utils.getNodeName(node.data),
242 id: id,
243 value: encodeValue(value, false, ctx.config.eli),
244 }
245}
246
247/**
248 * Pre-observe component props without gathering data.

Callers 1

collect_owner_detailsFunction · 0.85

Calls 5

getSdtIdFunction · 0.90
observeValueUpdateFunction · 0.90
encodeValueFunction · 0.90
value_node_make_objFunction · 0.85
handlerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…