Skip to content
Source
Sign inSign up
TanStack/db

fix(db): harden incremental subset recovery #1756

MergedKyleAMathews(GitHub profile, opens in a new tab)merged 35 commits intomain fromrefs/pull/1756/headmerged by tannerlinsley

Showing 27 changed files with 58 additions and 0 deletions (loading 24).

x
0 of 27 viewed, 27 left
7 additions and 0 deletions.changeset/report-incremental-subset-errors.mdAdded
View file
@@ -0,0 +1,7 @@
+---
+'@tanstack/db': patch
+'@tanstack/electric-db-collection': patch
+'@tanstack/trailbase-db-collection': patch
+---
+​
+Report incremental subset-load failures through subscriptions, live-query utilities, and effects while keeping cached source rows available. Recover cleanly from failed or overlapping must-refetch replays, collection cleanup, effect teardown errors, and cooperative adapter cancellation. Electric's shared-stream snapshot path still depends on upstream request identity or cancellation support to prevent rows from an aborted request from arriving before the request Promise settles.
44 additions and 0 deletionsdocs/guides/error-handling.mdModified
View file
@@ -119,6 +119,50 @@
- **`errorCount`**: Returns the number of consecutive sync failures. This counter is incremented only when queries fail completely (not per retry attempt) and is reset on successful queries:
- **`clearError()`**: Clears the error state and triggers a refetch of the query. This method resets both `lastError` and `errorCount`:
​
+## Incremental Subset Load Errors
+​
+An incremental `loadSubset` failure does not discard rows that are already
+available or put the shared source collection into `error`. The failure belongs
+to the subscription that requested that subset:
+​
+```ts
+const subscription = todoCollection.subscribeChanges(handleChanges, {
+ includeInitialState: false,
+})
+​