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

Function reconcileStructure

packages/frontend/src/structure.tsx:256–281  ·  view source on GitHub ↗
(
    prevRoots: Node[],
    {removed, updated, partial}: debug.StructureUpdates,
)

Source from the content-addressed store, hash-verified

254}
255
256export function reconcileStructure(
257 prevRoots: Node[],
258 {removed, updated, partial}: debug.StructureUpdates,
259): State {
260 Updated = updated
261 NewNodeList = []
262 const nextRoots: Node[] = []
263
264 const upatedTopLevelRoots = new Set<debug.NodeID>()
265 for (const root of prevRoots) {
266 const {id} = root
267 // skip removed roots for partial updates
268 // and for full updates skip roots that were not sent
269 if (partial ? removed.includes(id) : !(id in Updated)) continue
270 upatedTopLevelRoots.add(id)
271 nextRoots.push(updateNode(root, id, Updated[id]?.[id], 0))
272 }
273
274 for (const [rootId, updatedNodes] of entries(Updated)) {
275 const root = updatedNodes![rootId]
276 if (!root || upatedTopLevelRoots.has(rootId)) continue
277 nextRoots.push(createNode(root, null, 0))
278 }
279
280 return {roots: nextRoots, nodeList: NewNodeList}
281}
282
283export const path_height = theme.spacing[4.5]
284export const row_height = theme.spacing[4.5]

Callers 1

updateStructureFunction · 0.85

Calls 2

updateNodeFunction · 0.85
createNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…