Skip to content
0

katanakit-js / matchQuery

Function: matchQuery() ​

ts
function matchQuery(filters, query): boolean;

Defined in: node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/hydration-B9t5w6NC.d.ts:962

Checks whether a query matches the given QueryFilters. Every filter that is specified must match; filters that are left unspecified are ignored.

Parameters ​

ParameterType
filtersQueryFilters
queryQuery<any, any, any, any>

Returns ​

boolean

Example ​

ts
const queryCache = queryClient.getQueryCache()

const matchingQueries = queryCache
  .getAll()
  .filter((query) => matchQuery({ queryKey: ['posts'] }, query))

Released under the MIT License.