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

Method setQueriesData

packages/query-core/src/queryClient.ts:321–340  ·  view source on GitHub ↗

* Synchronous way to immediately update the cached data of multiple queries at once, using * filters or partial query key matching. Only queries that already exist and match the given * filters are updated; no new cache entries are created. Internally this calls * {@link QueryClient#setQuer

(
    filters: TQueryFilters,
    updater: Updater<
      NoInfer<TQueryFnData> | undefined,
      NoInfer<TQueryFnData> | undefined
    >,
    options?: SetDataOptions,
  )

Source from the content-addressed store, hash-verified

319 * ```
320 */
321 setQueriesData<
322 TQueryFnData,
323 TQueryFilters extends QueryFilters<any> = QueryFilters,
324 >(
325 filters: TQueryFilters,
326 updater: Updater<
327 NoInfer<TQueryFnData> | undefined,
328 NoInfer<TQueryFnData> | undefined
329 >,
330 options?: SetDataOptions,
331 ): Array<[QueryKey, TQueryFnData | undefined]> {
332 return notifyManager.batch(() =>
333 this.#queryCache
334 .findAll(filters)
335 .map(({ queryKey }) => [
336 queryKey,
337 this.setQueryData<TQueryFnData>(queryKey, updater, options),
338 ]),
339 )
340 }
341
342 /**
343 * Imperative (non-reactive) way to retrieve an existing query's state. If the query does not

Callers 10

WithKnownParametersFunction · 0.45
WithKnownParametersFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45

Calls 2

setQueryDataMethod · 0.95
findAllMethod · 0.45

Tested by

no test coverage detected