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

Function findClosestAliveParent

packages/debugger/src/main/roots.ts:166–181  ·  view source on GitHub ↗
(
    owner: Solid.Owner,
)

Source from the content-addressed store, hash-verified

164 * @returns `{ owner: SolidOwner; root: SolidRoot }`
165 */
166export function findClosestAliveParent(
167 owner: Solid.Owner,
168): {owner: Solid.Owner; root: Solid.Root} | {owner: null; root: null} {
169 let disposed: Solid.Root | null = null
170 let closestAliveRoot: Solid.Root | null = null
171 let current = owner
172 while (current.owner && !closestAliveRoot) {
173 current = current.owner
174 if (isSolidRoot(current)) {
175 if (current.isDisposed) disposed = current
176 else closestAliveRoot = current
177 }
178 }
179 if (!closestAliveRoot) return {owner: null, root: null}
180 return {owner: (disposed ?? owner).owner!, root: closestAliveRoot}
181}

Callers 2

attachDebuggerFunction · 0.85
onParentCleanupFunction · 0.85

Calls 1

isSolidRootFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…