Skip to content
Source
Sign inSign up
TanStack/db

feat(db): expose authoritative base rows through collection.base #1982

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

Showing 5 changed files with 27 additions and 0 deletions (loading 2).

x
0 of 5 viewed, 5 left
5 additions and 0 deletions.changeset/expose-authoritative-base-rows.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/db': patch
+---
+​
+Expose `collection.base` for synchronous reads of applied authoritative rows without optimistic overlays. Reading the base does not start sync.
1 addition and 0 deletionsdocs/contributing/glossary.mdModified
View file
@@ -37,6 +37,7 @@
| truncate replay | An authoritative source replacement after a truncate, inside the current sync run. The Collection subscription remains active; any dependent live-query graph remains active behind its publication barrier. | Restart, reload, retry, or repair. |
| source snapshot | The source rows established by one snapshot operation within its declared predicate and window. It proves full-source state only when the provider says that scope is authoritative and exhausted. | Public snapshot or proof of full-source coverage. |
| public snapshot | The last coherent set of rows exposed to reads, events, and downstream queries. | Private replacement or source snapshot. |
+| exposed authoritative base | The applied source rows available before a Collection adds optimistic mutations. Committed sync writes queued for reconciliation are not part of this base. `collection.base` reads it without starting sync. | Visible Collection state or a pending sync queue. |
| private replacement | Source or graph state withheld while an authoritative replay or repair is incomplete. | Public snapshot. |
| publication | The boundary that makes one coherent result observable to reads, events, and downstream queries. | Provider return, request settlement, or sync commit by itself. |
| atomic publication | One publication boundary at which state, events, and consumers observe the same result without an intermediate public state. | Any individual `commit()` call or source snapshot. |
21 additions and 0 deletionspackages/db/src/collection/index.tsModified
View file
@@ -14,6 +14,7 @@
import { CollectionIndexesManager } from './indexes'
import { CollectionMutationsManager } from './mutations'