Skip to content
Source
Sign inSign up
TanStack/db

test(browser-sqlite): cover Electric insert across immediate reload #1914

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

Showing 7 changed files with 90 additions and 0 deletions (loading 4).

x
0 of 7 viewed, 7 left
5 additions and 0 deletionsdocs/collections/electric-collection.mdModified
View file
@@ -316,6 +316,11 @@
​
This is useful when you need to ensure a mutation has been synchronized before proceeding with other operations.
​
+For a collection wrapped with SQLite persistence, `awaitTxId` observes the
+transaction in the Electric stream. It can resolve before the local SQLite
+write completes. Do not use it as a local durability acknowledgment: if the
+page closes in that gap, reopening may need Electric to recover the row.
+​
### `awaitMatch(matchFn, timeout?)`
​
Wait for a custom match function to find a matching message:
16 additions and 0 deletionsdocs/contributing/oracle-coverage.mdModified
View file
@@ -136,6 +136,22 @@
The [issue #1912 review record](oracle-reviews/issue-1912-eager-index-history.md)
records the grammar controls, exact reviewed commit, and ORC audit.
​
+The [live Electric immediate-reload witness](../../packages/browser-db-sqlite-persistence/e2e/electric-immediate-reload.opfs.spec.ts)
+checks one Chromium/OPFS history: an `onInsert` handler receives PostgreSQL
+transaction evidence, `awaitTxId` and the optimistic transaction settle while
+the source row's adapter write is held, and a hard page close is followed by