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

Function getResult

packages/angular-query/src/inject-mutation-state.ts:47–63  ·  view source on GitHub ↗

* Reads and projects the matching entries in a mutation cache. * @param mutationCache - The cache to inspect. * @param options - Filters and an optional projection for each entry. * @returns The selected values, or each matching mutation state.

(
  mutationCache: MutationCache,
  options: MutationStateOptions<TResult, TMutation>,
)

Source from the content-addressed store, hash-verified

45 * @returns The selected values, or each matching mutation state.
46 */
47function getResult<
48 TResult = MutationState,
49 TMutation extends Mutation<any, any, any, any> =
50 MutationTypeFromResult<TResult>,
51>(
52 mutationCache: MutationCache,
53 options: MutationStateOptions<TResult, TMutation>,
54): Array<TResult> {
55 return mutationCache
56 .findAll(options.filters)
57 .map(
58 (mutation): TResult =>
59 (options.select
60 ? options.select(mutation as TMutation)
61 : mutation.state) as TResult,
62 )
63}
64
65/**
66 * Injects a signal that gives you access to all mutations in the `MutationCache`. You can pass `filters`

Callers 1

injectMutationStateFunction · 0.70

Calls 1

findAllMethod · 0.45

Tested by

no test coverage detected