Skip to content
Source
Sign inSign up
TanStack/db

Keep Query collection errors visible until retry succeeds #1940

MergedKyleAMathews(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/1940/headmerged by KyleAMathews(GitHub profile, opens in a new tab)

Showing 7 changed files with 8 additions and 3 deletions (loading 4).

x
0 of 7 viewed, 7 left
5 additions and 0 deletions.changeset/fix-query-error-retry.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/query-db-collection': patch
+---
+​
+Keep the previous query error visible while `clearError()` retries. Clear the error after a successful retry, and count a failed retry as another consecutive failure.
2 additions and 2 deletionsdocs/collections/query-collection.mdModified
View file
@@ -660,8 +660,8 @@
- Bypasses `enabled: false` to support imperative/manual refetching patterns (similar to hook `refetch()` behavior)
- Returns the tracked Queries' `QueryObserverResult` values in tracked-key order
- Preserves an `undefined` slot if a tracked Query is removed while the refetch starts
-- `clearError()`: Clear recorded Query error state and refetch with errors enabled
- - Uses the same phase-dependent boundary as `refetch()`
+- `clearError()`: Refetch with errors enabled; retain the recorded error until a successful result applies to the Collection
+ - Uses the same phase-dependent boundary as `refetch()`. During a mutation handler, the promise can resolve at the fetch boundary before the result applies and clears the error.
​
## Direct Writes
​
1 addition and 1 deletiondocs/contributing/oracle-coverage.mdModified
View file