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

PacedMutationsConfig.md

79 lines1.6 KB

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