MCPcopy Create free account
hub / github.com/effect-app/libs / trackReadDependencies

Function trackReadDependencies

packages/vue/src/atomQuery.ts:100–107  ·  view source on GitHub ↗
(key: ReadonlyArray<unknown>, getReads: () => DataDependencies.DataDependencies)

Source from the content-addressed store, hash-verified

98 * invalidation target. Re-asserting the last-known reads on every (re)subscribe closes that gap, so the
99 * registry mirrors the live query even across cache-hit remounts.
100 */
101const trackReadDependencies =
102 (key: ReadonlyArray<unknown>, getReads: () => DataDependencies.DataDependencies) =>
103 <A, E>(atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>): Atom.Atom<AsyncResult.AsyncResult<A, E>> =>
104 Atom.transform(atom, (get) => {
105 const reads = getReads()
106 if (DataDependencies.isNonEmpty(reads)) setQueryReadDependencies(key, reads)
107 get.addFinalizer(() => clearQueryReadDependencies(key))
108 return get(atom)
109 }, { initialValueTarget: atom })
110

Callers 1

buildQueryFamilyFunction · 0.85

Calls 5

setQueryReadDependenciesFunction · 0.90
addFinalizerMethod · 0.80
getFunction · 0.70
transformMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…