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

PacedMutationsConfig.md

81 lines1.6 KB

1---
2id: PacedMutationsConfig
3title: PacedMutationsConfig
4---
5​
6# Interface: PacedMutationsConfig\<TVariables, T\>
7​
8Defined in: [packages/db/src/paced-mutations.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L8)
9​
10Configuration for creating a paced mutations manager
11​
12## Type Parameters
13​
14### TVariables
15​
16`TVariables` = `unknown`
17​
18### T
19​
20`T` *extends* `object` = `Record`\<`string`, `unknown`\>
21​
22## Properties
23​
24### metadata?
25​
26```ts
27optional metadata: Record<string, unknown>;
28```
29​
30Defined in: [packages/db/src/paced-mutations.ts:30](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L30)
31​
32Custom metadata to associate with transactions
33​
34***
35​
36### mutationFn
37​
38```ts
39mutationFn: MutationFn<T>;
40```
41​
42Defined in: [packages/db/src/paced-mutations.ts:21](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L21)
43​
44Function to execute the mutation on the server.
45Receives the transaction parameters containing all merged mutations.
46​
47***
48​
49### onMutate()
50​
51```ts
52onMutate: (variables) => void;
53```
54​
55Defined in: [packages/db/src/paced-mutations.ts:16](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L16)
56​
57Callback to apply optimistic updates immediately.
58Receives the variables passed to the mutate function.
59​
60#### Parameters
61​
62##### variables
63​
64`TVariables`
65​
66#### Returns
67​
68`void`
69​
70***
71​
72### strategy
73​
74```ts
75strategy: Strategy;
76```
77​
78Defined in: [packages/db/src/paced-mutations.ts:26](https://github.com/TanStack/db/blob/main/packages/db/src/paced-mutations.ts#L26)
79​
80Strategy for controlling mutation execution timing
81Examples: debounceStrategy, queueStrategy, throttleStrategy