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

Function refetch

packages/vue/src/internal/tanstackQuery.ts:246–265  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

244 const latestSuccessRef = computed(() => latestSuccess.value)
245 const atom = computed<Atom.Atom<AsyncResult.AsyncResult<TData, E>>>(() => Atom.readable(() => result.value))
246
247 const awaitResult = (): Effect.Effect<TData, E> =>
248 Effect
249 .tryPromise({
250 try: async () => {
251 const queryResult = await tanstack.suspense()
252 const data = queryResult.data
253 if (data === undefined) {
254 throw new Error("TanStack query resolved without data")
255 }
256 seedLatestSuccess(data)
257 return data
258 },
259 catch: (error) => error
260 })
261 .pipe(
262 Effect.catch((error) => recoverCauseException<TData, E>(error))
263 )
264
265 const refetch = (): Effect.Effect<TData, E> =>
266 Effect.gen(function*() {
267 const span = yield* Effect.currentParentSpan.pipe(Effect.orElseSucceed(() => undefined))
268 return yield* Effect

Callers 1

fetchFunction · 0.70

Calls 3

recoverCauseExceptionFunction · 0.85
catchMethod · 0.80
pipeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…