MCPcopy Create free account
hub / github.com/SvelteStack/svelte-query / fetchOptimistic

Method fetchOptimistic

src/queryCore/core/queryObserver.ts:328–352  ·  view source on GitHub ↗
(
    options: QueryObserverOptions<
      TQueryFnData,
      TError,
      TData,
      TQueryData,
      TQueryKey
    >
  )

Source from the content-addressed store, hash-verified

326 }
327
328 fetchOptimistic(
329 options: QueryObserverOptions<
330 TQueryFnData,
331 TError,
332 TData,
333 TQueryData,
334 TQueryKey
335 >
336 ): Promise<QueryObserverResult<TData, TError>> {
337 const defaultedOptions = this.client.defaultQueryObserverOptions(options)
338
339 const query = this.client
340 .getQueryCache()
341 .build(
342 this.client,
343 defaultedOptions as unknown as QueryOptions<
344 TQueryFnData,
345 TError,
346 TQueryData,
347 TQueryKey
348 >
349 )
350
351 return query.fetch().then(() => this.createResult(query, defaultedOptions))
352 }
353
354 protected fetch(
355 fetchOptions?: ObserverFetchOptions

Callers

nothing calls this directly

Calls 5

createResultMethod · 0.95
getQueryCacheMethod · 0.80
buildMethod · 0.45
fetchMethod · 0.45

Tested by

no test coverage detected