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

Function getComponent

packages/debugger/src/structure/walker.ts:134–156  ·  view source on GitHub ↗
(
    r:  ComponentRegistry<TEl>,
    id: NodeID,
)

Source from the content-addressed store, hash-verified

132
133export
134const getComponent = <TEl extends object>(
135 r: ComponentRegistry<TEl>,
136 id: NodeID,
137): {name: string | undefined; id: NodeID; elements: TEl[]} | null => {
138 // provided if might be of an element node (in DOM mode) or component node
139 // both need to be checked
140
141 let component = r.components.get(id)
142 if (component != null) return {
143 name: component.name,
144 elements: [...component.elements],
145 id: id,
146 }
147
148 let el_data = r.element_nodes.get(id)
149 if (el_data == null) return null
150
151 return {
152 name: el_data.component.name,
153 id: el_data.component.id,
154 elements: [el_data.el],
155 }
156}
157
158/**
159 * Searches for an HTML element with the given id in the component with the given id.

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…