[x] I've validated the bug against the latest version of DB packages
Describe the bug#
When adding a bale, the item is correctly stored in memory, but after refreshing the page the data disappears.
@tanstack/browser-db-sqlite-persistence does not seem to persist the collection.
export const baleCollection = createCollection(
persistedCollectionOptions<Bale, string | number>({
...electricCollectionOptions({
id: "bales",
shapeOptions: {
url: getElectricUrl(),
params: { table: "bale" },
},
getKey: (i) => i.id,
async onInsert({ transaction, collection }) {
const newItem = transaction.mutations[0].modified;
const txid = await createBale(newItem);
await collection.utils.awaitTxId(txid);
},
}),
persistence,
schemaVersion: 1,
})
);
To Reproduce#
Steps to reproduce:
- Add an item
- Refresh the page
- The previously added data is gone
Expected behavior#
Data should persist across page reloads when using SQLite persistence.
Desktop (please complete the following information):#
- OS: Windows 11
- Browser: Edge
- Version: 146.0.3856.97
Smartphone (please complete the following information):#
N/A
Additional context#
@tanstack/browser-db-sqlite-persistence: 0.1.6
@tanstack/electric-db-collection: 0.3.0
@tanstack/react-db: 0.1.80
I tested the reported
onInsert→awaitTxId→ immediate refresh sequence against currentmainwith live PostgreSQL/Electric and Chromium OPFS. The acknowledgment completed while the local SQLite row write was deliberately held (the row was visible in the Collection but absent from OPFS). After a hard page close, a new page recovered that server row and persisted it. PR #1914 adds this host-level regression check and clarifies thatawaitTxIdis Electric stream evidence, not a local SQLite durability acknowledgment.This does not verify Windows 11/Edge or the older package versions in the report, and it does not establish offline recovery in the pre-durability gap. I’m leaving #1456 open. If the issue still occurs on current packages in Edge, a minimal reproduction plus the post-refresh Electric/console errors would help isolate the Edge-specific path.