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

Method refetchQueries

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

Source from the content-addressed store, hash-verified

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