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:856](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L856)
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:858](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L858)
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:859](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L859)
38​
39***
40​
41### error
42​
43```ts
44readonly error: HealthProblem | null;
45```
46​
47Defined in: [packages/db/src/types.ts:866](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L866)
48​
49***
50​
51### failureReason
52​
53```ts
54readonly failureReason: HealthProblem | null;
55```
56​
57Defined in: [packages/db/src/types.ts:865](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L865)
58​
59***
60​
61### hasErrors
62​
63```ts
64readonly hasErrors: boolean;
65```
66​
67Defined in: [packages/db/src/types.ts:864](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L864)
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:861](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L861)
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:871](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L871)
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:872](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L872)
105​
106***
107​
108### status
109​
110```ts
111readonly status: CollectionStatus;
112```
113​
114Defined in: [packages/db/src/types.ts:862](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L862)