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

Function debugOwnerComputations

packages/logger/src/index.ts:219–258  ·  view source on GitHub ↗
(_owner?: Solid.Owner)

Source from the content-addressed store, hash-verified

217 */
218export function debugOwnerComputations(owner?: Solid.Owner): void
219export function debugOwnerComputations(_owner?: Solid.Owner): void {
220 const owner = _owner === undefined ? getOwner() : _owner
221 if (!owner) return console.warn('no owner passed to debugOwnedComputations')
222
223 const marked = markDebugNode(owner, 'owned')
224 if (marked === true) return
225 onCleanup(marked)
226
227 // for solid-refresh HMR memos, return the owned component
228 const {type, typeName, name} = getNodeState(
229 lookupOwner(owner, o => getOwnerType(o) !== NodeType.Refresh)!,
230 )
231
232 let prevOwned: Solid.Computation[] = []
233
234 onCleanup(
235 addSolidUpdateListener(() => {
236 const {owned} = owner
237 if (!owned) return
238
239 let computations: Solid.Computation[] = []
240
241 let i = prevOwned.length
242 // owned can only be added
243 for (; i < owned.length; i++) {
244 const computation = owned[i]!
245 debugComputation(computation, {
246 initialRun: false,
247 })
248 computations.push(computation)
249 }
250 if (computations.length === 0) return
251
252 computations = [...prevOwned, ...computations]
253 // log owned computation changes
254 logOwned({type, typeName, name}, computations, prevOwned)
255 prevOwned = computations
256 }),
257 )
258}
259
260export interface DebugSignalOptions {
261 trackObservers?: boolean

Callers

nothing calls this directly

Calls 8

getNodeStateFunction · 0.90
lookupOwnerFunction · 0.90
getOwnerTypeFunction · 0.90
addSolidUpdateListenerFunction · 0.90
logOwnedFunction · 0.90
markDebugNodeFunction · 0.85
onCleanupFunction · 0.85
debugComputationFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…