(queryRepo: DataDependencies.DataDependency)
| 231 | out = fn() |
| 232 | }) |
| 233 | }) |
| 234 | return out |
| 235 | } |
| 236 | return { run, dispose: () => scope.stop() } |
| 237 | } |
| 238 | |
| 239 | it("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] |
nothing calls this directly
no test coverage detected
searching dependent graphs…