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

CollectionDependent.md

62 lines1.5 KB

1---
2id: CollectionDependent
3title: CollectionDependent
4---
5​
6Defined in: [packages/db/src/types.ts:1187](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L1187)
7​
8Something that reads a Collection, as listed by `collection.subscribers`:
9a live query, an Effect, or a direct subscription.
10​
11## Properties
12​
13### active
14​
15```ts
16readonly active: boolean;
17```
18​
19Defined in: [packages/db/src/types.ts:1196](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L1196)
20​
21Whether something still reads through this dependent: an Effect or a
22subscription always does; a live query does while it has a subscriber.
23`cleanup()` refuses only while an active live query or Effect remains.
24​
25***
26​
27### collection?
28​
29```ts
30readonly optional collection: Collection<any, any, any, any, any>;
31```
32​
33Defined in: [packages/db/src/types.ts:1190](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L1190)
34​
35A live query's Collection; a pooled live query has none.
36​
37***
38​
39### end()
40​
41```ts
42end: () => Promise<void>;
43```
44​
45Defined in: [packages/db/src/types.ts:1201](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L1201)
46​
47End this dependent: clean up the live query with its own dependents,
48dispose the Effect, or end the subscription.
49​
50#### Returns
51​
52`Promise`\<`void`\>
53​
54***
55​
56### kind
57​
58```ts
59readonly kind: "live-query" | "effect" | "subscription";
60```
61​
62Defined in: [packages/db/src/types.ts:1188](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L1188)