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

Function makeTanstackHarness

packages/vue/test/dependencyInvalidation.test.ts:233–252  ·  view source on GitHub ↗
(queryRepo: DataDependencies.DataDependency)

Source from the content-addressed store, hash-verified

231 out = fn()
232 })
233 })
234 return out
235 }
236 return { run, dispose: () => scope.stop() }
237}
238
239it("tanstack engine: a query records reads, and a command's writes refetch it", async () => {
240 const tsRepo = DataDependencies.repo("TanstackRepo")
241 const queryClient = new QueryClient({
242 defaultOptions: { queries: { retry: false, gcTime: Infinity, staleTime: 0 } }
243 })
244 const useQuery = makeTanstackQuery(() => Context.empty(), queryClient)
245
246 let runs = 0
247 const self = { id: "TanstackInv.List", handler: () => DataDependencies.read(tsRepo).pipe(Effect.as(++runs)) }
248 const ctx = makeTanstackContext(queryClient)
249 const [, , , handle] = ctx.run(() => useQuery(self as any)(ref(undefined) as any, {} as any)) as any
250
251 try {
252 await Effect.runPromise(handle.refetch())
253 expect(runs).toBe(1)
254
255 const fullKey = [...makeQueryKey(self), undefined]

Callers

nothing calls this directly

Calls 10

makeQueryKeyFunction · 0.90
makeTanstackQueryFunction · 0.85
useQueryFunction · 0.85
invalidateQueriesFunction · 0.85
readMethod · 0.80
disposeMethod · 0.80
makeTanstackContextFunction · 0.70
pipeMethod · 0.65
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…