Skip to content
Source
Sign inSign up
TanStack/db

perf(offline-transactions): bound bulk replay lookup work #1958

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

Showing 5 changed files with 14 additions and 22 deletions (loading 2).

x
0 of 5 viewed, 5 left
5 additions and 0 deletions.changeset/streamline-offline-replay-work.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/offline-transactions': patch
+---
+​
+Reduce work when bulk retry updates and filtered replay process large offline outboxes. Keep FIFO order and the same retained transactions.
7 additions and 18 deletionspackages/offline-transactions/src/executor/KeyScheduler.tsModified
View file
@@ -85,16 +85,7 @@
​
updateTransaction(transaction: OfflineTransaction): void {
- const index = this.pendingTransactions.findIndex(
- (tx) => tx.id === transaction.id,
- )
- if (index >= 0) {
- this.pendingTransactions[index] = transaction
- // Re-sort to maintain FIFO order after update
- this.pendingTransactions.sort(
- (a, b) => a.createdAt.getTime() - b.createdAt.getTime(),
- )
- }
+ this.updateTransactions([transaction])
​