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

Method setQueriesData

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

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