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

Method find

packages/query-core/src/mutationCache.ts:319–332  ·  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

317 * ```
318 */
319 find<
320 TData = unknown,
321 TError = DefaultError,
322 TVariables = any,
323 TOnMutateResult = unknown,
324 >(
325 filters: MutationFilters,
326 ): Mutation<TData, TError, TVariables, TOnMutateResult> | undefined {
327 const defaultedFilters = { exact: true, ...filters }
328
329 return this.getAll().find((mutation) =>
330 matchMutation(defaultedFilters, mutation),
331 ) as Mutation<TData, TError, TVariables, TOnMutateResult> | undefined
332 }
333
334 /**
335 * 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