Skip to content
Source
Sign inSign up
TanStack/db

feat: add error tracking and retry methods to query collection utils #441

Mergedlucasweng(GitHub profile, opens in a new tab)merged 7 commits intomain fromrefs/pull/441/headmerged by KyleAMathews(GitHub profile, opens in a new tab)

Showing 4 changed files with 107 additions and 6 deletions (loading 1).

x
0 of 4 viewed, 4 left
5 additions and 0 deletions.changeset/clear-days-raise.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+"@tanstack/query-db-collection": patch
+---
+​
+Add error tracking and retry methods to query collection utils.
47 additions and 0 deletionsdocs/guides/error-handling.mdModified
View file
@@ -45,6 +45,52 @@
- `issues`: Array of validation issues with messages and paths
- `message`: A formatted error message listing all issues
​
+## Query Collection Error Tracking
+​
+Query collections provide enhanced error tracking utilities through the `utils` object. These methods expose error state information and provide recovery mechanisms for failed queries:
+​
+```tsx
+import { createCollection } from "@tanstack/db"
+import { queryCollectionOptions } from "@tanstack/query-db-collection"
+import { useLiveQuery } from "@tanstack/react-db"
+​
+const syncedCollection = createCollection(
+ queryCollectionOptions({
+ queryClient,
+ queryKey: ['synced-data'],