Open History to see the last commit
1---
2id: EffectConfig
3title: EffectConfig
4---
5
6Defined in: [packages/db/src/query/effect.ts:112](https://github.com/TanStack/db/blob/main/packages/db/src/query/effect.ts#L112)
7
8Effect configuration
9
10## Type Parameters
11
12### TRow
13
14`TRow` *extends* `object` = `Record`\<`string`, `unknown`\>
15
16### TKey
17
18`TKey` *extends* `string` \| `number` = `string` \| `number`
19
20## Properties
21
22### id?
23
24```ts
25optional id: string;
26```
27
28Defined in: [packages/db/src/query/effect.ts:117](https://github.com/TanStack/db/blob/main/packages/db/src/query/effect.ts#L117)
29
30Optional ID for debugging/tracing
31
32***
33
34### onBatch?
35
36```ts
37optional onBatch: EffectBatchHandler<TRow, TKey>;
38```
39
40Defined in: [packages/db/src/query/effect.ts:132](https://github.com/TanStack/db/blob/main/packages/db/src/query/effect.ts#L132)
41
42Called once per graph run with all delta events from that batch
43
44***
45
46### onEnter?
47
48```ts
49optional onEnter: EffectEventHandler<TRow, TKey>;
50```
51
52Defined in: [packages/db/src/query/effect.ts:123](https://github.com/TanStack/db/blob/main/packages/db/src/query/effect.ts#L123)
53
54Called once for each row entering the query result
55
56***
57
58### onError()?
59
60```ts
61optional onError: (error, event) => void;
62```
63
64Defined in: [packages/db/src/query/effect.ts:135](https://github.com/TanStack/db/blob/main/packages/db/src/query/effect.ts#L135)
65
66Error handler for exceptions thrown by effect callbacks
67
68#### Parameters
69
70##### error
71
72`Error`
73
74##### event
75
76[`DeltaEvent`](../type-aliases/DeltaEvent.md)\<`TRow`, `TKey`\>
77
78#### Returns
79
80`void`
81
82***
83
84### onExit?
85
86```ts
87optional onExit: EffectEventHandler<TRow, TKey>;
88```
89
90Defined in: [packages/db/src/query/effect.ts:129](https://github.com/TanStack/db/blob/main/packages/db/src/query/effect.ts#L129)
91
92Called once for each row exiting the query result
93
94***
95
96### onHealthChange()?
97
98```ts
99optional onHealthChange: (health) => void;
100```
101
102Defined in: [packages/db/src/query/effect.ts:153](https://github.com/TanStack/db/blob/main/packages/db/src/query/effect.ts#L153)
103
104Called after the effect's initial-query readiness whenever its health tree
105changes. A sync problem after initial-query readiness does not dispose the
106effect; read the health tree to decide what to do.
107
108#### Parameters
109
110##### health
111
112[`HealthNode`](HealthNode.md)
113
114#### Returns
115
116`void`
117
118***
119
120### onSourceError()?
121
122```ts
123optional onSourceError: (error) => void;
124```
125
126Defined in: [packages/db/src/query/effect.ts:146](https://github.com/TanStack/db/blob/main/packages/db/src/query/effect.ts#L146)
127
128Called when a source crashes, fails its first load before the effect's
129initial-query readiness, or is cleaned up while the effect reads it, and
130when a subset load the effect requests from a source, or its release,
131fails, before or after that readiness. A cascade cleanup that ends the
132effect does not call it.
133The effect is automatically disposed after this callback fires. If not
134provided, the error is logged to console.error.
135
136#### Parameters
137
138##### error
139
140`Error`
141
142#### Returns
143
144`void`
145
146***
147
148### onUpdate?
149
150```ts
151optional onUpdate: EffectEventHandler<TRow, TKey>;
152```
153
154Defined in: [packages/db/src/query/effect.ts:126](https://github.com/TanStack/db/blob/main/packages/db/src/query/effect.ts#L126)
155
156Called once for each row updating within the query result
157
158***
159
160### query
161
162```ts
163query: EffectQueryInput<any>;
164```
165
166Defined in: [packages/db/src/query/effect.ts:120](https://github.com/TanStack/db/blob/main/packages/db/src/query/effect.ts#L120)
167
168Query to watch for deltas
169
170***
171
172### skipInitial?
173
174```ts
175optional skipInitial: boolean;
176```
177
178Defined in: [packages/db/src/query/effect.ts:160](https://github.com/TanStack/db/blob/main/packages/db/src/query/effect.ts#L160)
179
180Skip deltas during initial collection load.
181Defaults to false (process all deltas including initial sync).
182Set to true for effects that should only process new changes.