mirror of
https://github.com/TanStack/query.git
synced 2026-11-16 22:50:20 +00:00
* docs(*): add parameter and result property tables to reference function pages and an overview to overloaded ones * docs(*): link to the base type's properties when a parameter or result type has no property table * docs(framework/*/reference): regenerate reference docs * docs(framework/*/reference): regenerate reference docs * chore(scripts/generate-docs): restore the 'dirname' import that the merge dropped * docs(framework/*/reference): regenerate reference docs * docs(scripts/generate-docs): label overloads in the overview with their declared parameter and return types * docs(framework/*/reference): regenerate reference docs * docs(scripts/generate-docs): convert declared intersection types from the source so signatures keep their alias names * docs(framework/*/reference): regenerate reference docs * docs(scripts/generate-docs): reword a comment to avoid the unknown word 'inlines' * docs(scripts/generate-docs): skip a parameter table on overloaded pages when its heading is missing
1.9 KiB
1.9 KiB
| id | title |
|---|---|
| matchQuery | matchQuery |
function matchQuery(filters: QueryFilters, query: Query<any, any, any, any>): boolean;
Defined in: packages/query-core/src/utils.ts:205
Checks whether a query matches the given QueryFilters. Every filter that is specified must match; filters that are left unspecified are ignored.
Parameters
filters
The filters to check the query against.
filters properties
| Property | Type | Default value | Description |
|---|---|---|---|
exact? |
boolean |
undefined |
Match query key exactly |
fetchStatus? |
"fetching" | "paused" | "idle" |
undefined |
Include queries matching their fetchStatus |
predicate? |
(query: Query) => boolean |
undefined |
Include queries matching this predicate function |
queryKey? |
TQueryKey | TuplePrefixes<TQueryKey> |
undefined |
Include queries matching this query key |
stale? |
boolean |
undefined |
Include or exclude stale queries |
type? |
QueryTypeFilter |
'all' |
Filter to active queries, inactive queries or all queries |
query
Query<any, any, any, any>
The query to check.
Returns
boolean
true if the query matches every specified filter.
Example
const queryCache = queryClient.getQueryCache()
const matchingQueries = queryCache
.getAll()
.filter((query) => matchQuery({ queryKey: ['posts'] }, query))