Skip to content
Source
Sign inSign up
TanStack/db

fix(offline): fence individual outbox clear deletions #1836

Mergedtannerlinsleymerged 1 commit intomain fromrefs/pull/1836/headmerged by tannerlinsley

Showing 3 changed files with 59 additions and 2 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/fix-outbox-clear-removal-fence.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/offline-transactions': patch
+---
+​
+Fence each successful outbox clear deletion from overlapping reads, including when another deletion is still pending or fails.
1 addition and 2 deletionspackages/offline-transactions/src/outbox/OutboxManager.tsModified
View file
@@ -173,8 +173,7 @@
const keys = await this.storage.keys()
const transactionKeys = keys.filter((key) => key.startsWith(this.keyPrefix))
​
- await Promise.all(transactionKeys.map((key) => this.storage.delete(key)))
- this.recordRemovals(
+ await this.removeMany(
transactionKeys.map((key) => key.slice(this.keyPrefix.length)),
53 additions and 0 deletionspackages/offline-transactions/tests/leadership-replay.property.test.tsModified
View file
@@ -947,3 +947,56 @@