Skip to content
Source
Sign inSign up
TanStack/db

Fix SQLite persistence ownership and on-demand peer reloads #2096

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

Showing 19 changed files with 182 additions and 3 deletions (loading 17).

x
0 of 19 viewed, 19 left
6 additions and 0 deletions.changeset/keep-sqlite-persistence-demand-scoped.mdAdded
View file
@@ -0,0 +1,6 @@
+---
+'@tanstack/db': patch
+'@tanstack/db-sqlite-persistence-core': patch
+---
+​
+Reject reuse of mutable persisted and LocalStorage sync options across Collections while keeping DbClient materializations independent. Pass fresh options to each direct `createCollection(...)`; DbClient descriptors remain reusable. Keep on-demand peer reloads and schema resets scoped to active demand and previously visible rows. Refresh or delete visible rows from durable evidence without replacing unconfirmed DbClient hydration rows or metadata. Resolve targeted peer updates from storage when their notice cannot distinguish a replacing insert from a partial update.
176 additions and 3 deletionsdocs/contributing/oracle-coverage.mdModified
View file
@@ -533,6 +533,23 @@
side effects, many-operation histories, or native browser scheduling. Those
need a widened peer-owner value/history grammar and a receiving browser witness.
​
+The LocalStorage peer owner checks descriptor admission after three failed
+constructor boundaries: invalid index configuration before sync binding,
+controlled browser-listener registration failure during sync startup, and a
+missing on-demand `loadSubset` handler after a browser listener was acquired.
+A corrected retry must persist; a third construction and reuse after successful
+owner cleanup must reject. The original owner can restart and persist, while
+controlled browser-listener counts return to zero after failure and cleanup.
+Paired hosts compare the Storage reads caused by one later same-tab write; the
+failed-construction host has one extra read on `8b3debb3a`, exposing an
+abandoned same-tab callback. These checks cannot prove that a failed Collection
+is no longer retained by a private adapter closure or an inert callback in
+the same-tab registry; those resource-retention claims need a receiving