Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

injectMutationState.md

47 lines1.6 KB

1---
2id: injectMutationState
3title: injectMutationState
4---
5​
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7​
8```ts
9function injectMutationState<TResult = MutationState<unknown, Error, unknown, unknown>, TMutation extends Mutation<any, any, any, any> = MutationTypeFromResult<TResult>>(options?: () => MutationStateOptions<TResult, TMutation>): Signal<TResult[]>;
10```
11​
12Defined in: [packages/angular-query/src/inject-mutation-state.ts:70](https://github.com/TanStack/query/blob/main/packages/angular-query/src/inject-mutation-state.ts#L70)
13​
14Injects a signal that tracks the state of all mutations.
15​
16## Type Parameters
17​
18### TResult
19​
20`TResult` = [`MutationState`](../interfaces/MutationState.md)\<`unknown`, `Error`, `unknown`, `unknown`\>
21​
22### TMutation
23​
24`TMutation` *extends* [`Mutation`](../classes/Mutation.md)\<`any`, `any`, `any`, `any`\> = `MutationTypeFromResult`\<`TResult`\>
25​
26## Parameters
27​
28### options?
29​
30() => [`MutationStateOptions`](../type-aliases/MutationStateOptions.md)\<`TResult`, `TMutation`\>
31​
32A function that returns mutation state options.
33​
34<a id="options-properties"></a>
35​
36#### `options` properties
37​
38| Property | Type | Description |
39| ------ | ------ | ------ |
40| <a id="options-property-filters"></a> `filters?` | [`MutationFilters`](../interfaces/MutationFilters.md) | Restricts the mutation cache entries included in the result. |
41| <a id="options-property-select"></a> `select?` | (`mutation`: `TMutation`) => `TResult` | Maps each matching mutation to the value exposed in the result signal. |
42​
43## Returns
44​
45`Signal`\<`TResult`[]\>
46​
47The signal that tracks the state of all mutations.