MCPcopy Create free account
hub / github.com/TanStack/query / refetchQueries

Method refetchQueries

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

Source from the content-addressed store, hash-verified

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