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

Method setQueriesData

packages/query-core/src/queryClient.ts:339–358  ·  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

337 * ```
338 */
339 setQueriesData<
340 TQueryFnData,
341 TQueryFilters extends QueryFilters<any> = QueryFilters,
342 >(
343 filters: TQueryFilters,
344 updater: Updater<
345 NoInfer<TQueryFnData> | undefined,
346 NoInfer<TQueryFnData> | undefined
347 >,
348 options?: SetDataOptions,
349 ): Array<[QueryKey, TQueryFnData | undefined]> {
350 return notifyManager.batch(() =>
351 this.#queryCache
352 .findAll(filters)
353 .map(({ queryKey }) => [
354 queryKey,
355 this.setQueryData<TQueryFnData>(queryKey, updater, options),
356 ]),
357 )
358 }
359
360 /**
361 * 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