0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-18 19:33:22 +00:00
query/docs/framework/react/reference/functions/matchMutation.md
Wonsuk Choi d169ee8778
docs(*): add property tables and overload overviews to reference pages and keep declared alias names (#11758)
* 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
2026-10-06 02:38:27 +09:00

1.7 KiB

id title
matchMutation matchMutation
function matchMutation(filters: MutationFilters, mutation: Mutation<any, any>): boolean;

Defined in: packages/query-core/src/utils.ts:269

Checks whether a mutation matches the given MutationFilters. Every filter that is specified must match; filters that are left unspecified are ignored. If a mutationKey filter is provided but the mutation has no mutationKey of its own, it does not match.

Parameters

filters

MutationFilters

The filters to check the mutation against.

filters properties

Property Type Description
exact? boolean Match mutation key exactly
mutationKey? readonly unknown[] Include mutations matching this mutation key
predicate? (mutation: Mutation<TData, TError, TVariables, TOnMutateResult>) => boolean Include mutations matching this predicate function
status? "error" | "pending" | "success" | "idle" Filter by mutation status

mutation

Mutation<any, any>

The mutation to check.

Returns

boolean

true if the mutation matches every specified filter.

Example

const mutationCache = queryClient.getMutationCache()

const matchingMutations = mutationCache
  .getAll()
  .filter((mutation) => matchMutation({ mutationKey: ['addPost'] }, mutation))