Skip to content
0

katanakit-js / matchMutation

Function: matchMutation() ​

ts
function matchMutation(filters, mutation): boolean;

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

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 ​

ParameterType
filtersMutationFilters
mutationMutation<any, any>

Returns ​

boolean

Example ​

ts
const mutationCache = queryClient.getMutationCache()

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

Released under the MIT License.