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

Method find

packages/query-core/src/mutationCache.ts:278–291  ·  view source on GitHub ↗

* A slightly more advanced method that can be used to get an existing mutation instance from * the cache. If the mutation does not exist, `undefined` is returned. * * This is not typically needed for most applications, but can come in handy when needing more * information about a mutatio

(
    filters: MutationFilters,
  )

Source from the content-addressed store, hash-verified

276 * ```
277 */
278 find<
279 TData = unknown,
280 TError = DefaultError,
281 TVariables = any,
282 TOnMutateResult = unknown,
283 >(
284 filters: MutationFilters,
285 ): Mutation<TData, TError, TVariables, TOnMutateResult> | undefined {
286 const defaultedFilters = { exact: true, ...filters }
287
288 return this.getAll().find((mutation) =>
289 matchMutation(defaultedFilters, mutation),
290 ) as Mutation<TData, TError, TVariables, TOnMutateResult> | undefined
291 }
292
293 /**
294 * An even more advanced method that can be used to get existing mutation instances from the

Callers 2

canRunMethod · 0.45
runNextMethod · 0.45

Calls 2

getAllMethod · 0.95
matchMutationFunction · 0.90

Tested by

no test coverage detected