Open History to see the last commit
1---
2id: SubscribeChangesSnapshotOptions
3title: SubscribeChangesSnapshotOptions
4---
5
6# Interface: SubscribeChangesSnapshotOptions\<T, TKey\>
7
8Defined in: [packages/db/src/types.ts:869](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L869)
9
10## Extends
11
12- `Omit`\<[`SubscribeChangesOptions`](SubscribeChangesOptions.md)\<`T`, `TKey`\>, `"includeInitialState"`\>
13
14## Type Parameters
15
16### T
17
18`T` *extends* `object` = `Record`\<`string`, `unknown`\>
19
20### TKey
21
22`TKey` *extends* `string` \| `number` = `string` \| `number`
23
24## Properties
25
26### limit?
27
28```ts
29optional limit: number;
30```
31
32Defined in: [packages/db/src/types.ts:874](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L874)
33
34**`Internal`**
35
36Optional limit to include in loadSubset for query-specific cache keys.
37
38#### Overrides
39
40[`SubscribeChangesOptions`](SubscribeChangesOptions.md).[`limit`](SubscribeChangesOptions.md#limit)
41
42***
43
44### onLoadSubsetResult()?
45
46```ts
47optional onLoadSubsetResult: (result) => void;
48```
49
50Defined in: [packages/db/src/types.ts:866](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L866)
51
52**`Internal`**
53
54Callback that receives the loadSubset result (Promise or true) from requestSnapshot.
55Allows the caller to directly track the loading promise for isReady status.
56
57#### Parameters
58
59##### result
60
61`true` | `Promise`\<`void`\>
62
63#### Returns
64
65`void`
66
67#### Inherited from
68
69```ts
70Omit.onLoadSubsetResult
71```
72
73***
74
75### onStatusChange()?
76
77```ts
78optional onStatusChange: (event) => void;
79```
80
81Defined in: [packages/db/src/types.ts:850](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L850)
82
83**`Internal`**
84
85Listener for subscription status changes.
86Registered BEFORE any snapshot is requested, ensuring no status transitions are missed.
87
88#### Parameters
89
90##### event
91
92[`SubscriptionStatusChangeEvent`](SubscriptionStatusChangeEvent.md)
93
94#### Returns
95
96`void`
97
98#### Inherited from
99
100```ts
101Omit.onStatusChange
102```
103
104***
105
106### orderBy?
107
108```ts
109optional orderBy: OrderBy;
110```
111
112Defined in: [packages/db/src/types.ts:873](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L873)
113
114**`Internal`**
115
116Optional orderBy to include in loadSubset for query-specific cache keys.
117
118#### Overrides
119
120[`SubscribeChangesOptions`](SubscribeChangesOptions.md).[`orderBy`](SubscribeChangesOptions.md#orderby)
121
122***
123
124### where()?
125
126```ts
127optional where: (row) => any;
128```
129
130Defined in: [packages/db/src/types.ts:842](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L842)
131
132Callback function for filtering changes using a row proxy.
133The callback receives a proxy object that records property access,
134allowing you to use query builder functions like `eq`, `gt`, etc.
135
136#### Parameters
137
138##### row
139
140`SingleRowRefProxy`\<[`WithVirtualProps`](../type-aliases/WithVirtualProps.md)\<`T`, `TKey`\>\>
141
142#### Returns
143
144`any`
145
146#### Example
147
148```ts
149import { eq } from "@tanstack/db"
150
151collection.subscribeChanges(callback, {
152 where: (row) => eq(row.status, "active")
153})
154```
155
156#### Inherited from
157
158```ts
159Omit.where
160```
161
162***
163
164### whereExpression?
165
166```ts
167optional whereExpression: BasicExpression<boolean>;
168```
169
170Defined in: [packages/db/src/types.ts:844](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L844)
171
172Pre-compiled expression for filtering changes
173
174#### Inherited from
175
176[`SubscribeChangesOptions`](SubscribeChangesOptions.md).[`whereExpression`](SubscribeChangesOptions.md#whereexpression)