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

HealthNode.md

114 lines2.6 KB

1---
2id: HealthNode
3title: HealthNode
4---
5​
6Defined in: [packages/db/src/types.ts:813](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L813)
7​
8One node of a health tree. A Collection's tree is one node; a live query's
9has one node for itself and one for each source alias in query order. The
10shape is fixed by the query, and nodes without a problem are present too.
11​
12A node shows at most one problem. `failureReason`: something went wrong and
13the sync adapter is still trying, so the problem clears by itself.
14`error`: the first load failed, the sync adapter stopped, the Collection
15crashed, or, on a live query's own node, a request for more data failed.
16​
17## Properties
18​
19### alias
20​
21```ts
22readonly alias: string;
23```
24​
25Defined in: [packages/db/src/types.ts:815](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L815)
26​
27The query alias, or `root` for the Collection the tree was read from.
28​
29***
30​
31### collectionId
32​
33```ts
34readonly collectionId: string;
35```
36​
37Defined in: [packages/db/src/types.ts:816](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L816)
38​
39***
40​
41### error
42​
43```ts
44readonly error: CollectionErrorInfo | null;
45```
46​
47Defined in: [packages/db/src/types.ts:823](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L823)
48​
49***
50​
51### failureReason
52​
53```ts
54readonly failureReason: CollectionErrorInfo | null;
55```
56​
57Defined in: [packages/db/src/types.ts:822](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L822)
58​
59***
60​
61### hasErrors
62​
63```ts
64readonly hasErrors: boolean;
65```
66​
67Defined in: [packages/db/src/types.ts:821](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L821)
68​
69This node or any node below it has a `failureReason` or an `error`.
70​
71***
72​
73### kind
74​
75```ts
76readonly kind: "source" | "include" | "live-query";
77```
78​
79Defined in: [packages/db/src/types.ts:818](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L818)
80​
81`include` is an include's source; its rows feed per-row child Collections.
82​
83***
84​
85### reloading
86​
87```ts
88readonly reloading: boolean;
89```
90​
91Defined in: [packages/db/src/types.ts:828](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L828)
92​
93A reload's new sync run is in flight: the rows, status, and problem shown
94are the previous run's until it commits or fails.
95​
96***
97​
98### sources
99​
100```ts
101readonly sources: readonly HealthNode[];
102```
103​
104Defined in: [packages/db/src/types.ts:829](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L829)
105​
106***
107​
108### status
109​
110```ts
111readonly status: CollectionStatus;
112```
113​
114Defined in: [packages/db/src/types.ts:819](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L819)