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

Function interceptComputationRerun

packages/debugger/src/main/observe.ts:50–67  ·  view source on GitHub ↗
(
    owner: Solid.Computation,
    onRun: <T>(execute: () => T, prev: T) => void,
)

Source from the content-addressed store, hash-verified

48 * ```
49 */
50export function interceptComputationRerun(
51 owner: Solid.Computation,
52 onRun: <T>(execute: () => T, prev: T) => void,
53): void {
54 const _fn = owner.fn
55 let v!: unknown
56 let prev!: unknown
57 const fn = () => (v = _fn(prev))
58 owner.fn = !!owner.fn.length
59 ? p => {
60 onRun(fn, (prev = p))
61 return v
62 }
63 : () => {
64 onRun(fn, undefined)
65 return v
66 }
67}
68
69const ComputationUpdateListeners = new WeakMap<Solid.Computation, Record<symbol, VoidFunction>>()
70

Callers 3

update.test.tsFile · 0.90
debugComputationFunction · 0.90
observeComputationUpdateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…