MCPcopy
hub / github.com/TanStack/query / refetchQueries

Method refetchQueries

packages/query-core/src/queryClient.ts:315–339  ·  view source on GitHub ↗
(
    filters?: RefetchQueryFilters<TTaggedQueryKey>,
    options: RefetchOptions = {},
  )

Source from the content-addressed store, hash-verified

313 }
314
315 refetchQueries<TTaggedQueryKey extends QueryKey = QueryKey>(
316 filters?: RefetchQueryFilters<TTaggedQueryKey>,
317 options: RefetchOptions = {},
318 ): Promise<void> {
319 const fetchOptions = {
320 ...options,
321 cancelRefetch: options.cancelRefetch ?? true,
322 }
323 const promises = notifyManager.batch(() =>
324 this.#queryCache
325 .findAll(filters)
326 .filter((query) => !query.isDisabled() && !query.isStatic())
327 .map((query) => {
328 let promise = query.fetch(undefined, fetchOptions)
329 if (!fetchOptions.throwOnError) {
330 promise = promise.catch(noop)
331 }
332 return query.state.fetchStatus === 'paused'
333 ? Promise.resolve()
334 : promise
335 }),
336 )
337
338 return Promise.all(promises).then(noop)
339 }
340
341 fetchQuery<
342 TQueryFnData,

Callers 15

resetQueriesMethod · 0.95
invalidateQueriesMethod · 0.95
WithKnownParametersFunction · 0.45
WithIdentifiersFunction · 0.45
WithKnownParametersFunction · 0.45
WithIdentifiersFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45

Calls 4

isDisabledMethod · 0.80
isStaticMethod · 0.80
findAllMethod · 0.45
fetchMethod · 0.45

Tested by

no test coverage detected