Skip to content
Source
Sign inSign up
TanStack/db

fix(offline-transactions): infinite retries by default and online-status gating #1301

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

Showing 9 changed files with 11 additions and 22 deletions (loading 6).

x
0 of 9 viewed, 9 left
5 additions and 0 deletions.changeset/fix-offline-retry-and-online-gating.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/offline-transactions': patch
+---
+​
+Fix retry behavior to not cap at 10 attempts and not burn retries while offline. Default retry policy now retries indefinitely with exponential backoff. Execution loop and retry timer check online status before attempting transactions. `OnlineDetector.isOnline()` is now a required method on the interface. `OfflineExecutor.notifyOnline()` has been removed — the online detector handles connectivity changes automatically.
2 additions and 17 deletionspackages/offline-transactions/README.mdModified
View file
@@ -5,7 +5,7 @@
## Features
​
- **Outbox Pattern**: Persist mutations before dispatch for zero data loss
-- **Automatic Retry**: Exponential backoff with jitter for failed transactions
+- **Automatic Retry**: Configurable retry behavior with exponential backoff + jitter by default
- **Multi-tab Coordination**: Leader election ensures safe storage access
- **FIFO Sequential Processing**: Transactions execute one at a time in creation order
- **Flexible Storage**: IndexedDB with localStorage fallback
@@ -129,6 +129,7 @@
beforeRetry?: (transactions: OfflineTransaction[]) => OfflineTransaction[]
onUnknownMutationFn?: (name: string, tx: OfflineTransaction) => void
onLeadershipChange?: (isLeader: boolean) => void
+ onlineDetector?: OnlineDetector