Skip to content
Source
Sign inSign up
TanStack/db

feat(db): add explicit local write and transaction settlement APIs #1979

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

Showing 56 changed files with 14 additions and 8 deletions (loading 53).

x
0 of 56 viewed, 56 left
5 additions and 0 deletions.changeset/clarify-write-status-apis.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/db': patch
+---
+​
+Add `tx.when('settled')` to await transaction completion and `$hasPendingWrites` to identify rows with local optimistic writes. Deprecate `isPersisted.promise` and `$synced` while keeping them available for existing code.
7 additions and 7 deletionsdocs/guides/error-handling.mdModified
View file
@@ -275,7 +275,7 @@
completed: false,
- await tx.isPersisted.promise
+ await tx.when('settled')
} catch (error) {
// The optimistic update has been automatically rolled back
console.error("Failed to create todo:", error)
@@ -312,7 +312,7 @@
draft.completed = true
- await tx.isPersisted.promise
+ await tx.when('settled')