Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

CHANGELOG.md

645 lines70.0 KB

@tanstack/db-sqlite-persistence-core

1.0.0-rc.1

Major Changes

  • Release the first 1.0 candidate. Remove deprecated pre-1.0 APIs and give (#2171) published row metadata precedence over colliding selected fields. Structured source spreads and direct source-row returns keep source attribution; new functional objects and other projections receive output Collection metadata. Keep the two packages accidentally released as stable 1.x on their stable release lines. Both stable minor releases require @tanstack/db@^1.0.0-rc.0 for the RC health and restoration settlement APIs; upgrade DB with them.

    Remove Query Collection’s automatic refetch after mutation handlers. Handlers return Promise<void> and must await collection.utils.refetch() or write confirmed data with the write* utilities; { refetch: false } is removed.

Minor Changes

  • Reloaded persisted collections now read their rows before they write a leader election term. A collection still takes its leader lock when it subscribes, but it reserves its durable term only after the database work already queued on the shared scheduler has settled, or as soon as something needs a leader during that election: a local write, a follower request, a sync commit during startup, or ensureLeadership. A need that an earlier leader already served does not let a later takeover skip the wait. A tab that takes over treats the departed leader's route as gone, so a sync commit queued behind one of its reads goes to the new leader and settles without waiting out an RPC timeout. The Electron renderer applies the same rule to its own hydrations. The renderer now has a hydration scope, so its startup runs as one hydration, as a Browser tab's does, and a restart keeps its metadata and row reads in one scope, so a term cannot run between them. (#2219)

    ensureLeadership now resolves when this node becomes leader, keeps its place in the Web Locks queue instead of replacing its lock request, and rejects if the coordinator is disposed.

    Migration for custom persistence adapters: runInRegularScope is now a RegularScope, which must also provide afterQueuedWork(). It resolves once every operation queued or running on the adapter's scheduler at the call has settled. An adapter without a scheduler can return a promise that settles with its running hydrations. A coordinator now rejects an adapter whose runInRegularScope lacks afterQueuedWork with InvalidPersistenceAdapterError.

  • initialRender: { strategy: 'network-first' } now works for on-demand persisted Collections, including Electric's progressive mode. Previously the configuration threw InvalidPersistedCollectionConfigError. (#2263)

    A subset load that settles online records persisted demand coverage for its exact demand. In a later session, a load of the same demand settles on its rows from SQLite once networkTimeoutMs (default 3 seconds) has passed, or at once if the network load fails. The network load keeps running, and its rows publish when they arrive. If it fails after that, the query stays ready. A demand that never settled online still waits for the network. Coverage proves that the rows were complete when they were loaded, not that they are still current. A source truncate, a snapshot transaction, scoped recovery, or a cache-generation rotation clears it. A load that a reset made obsolete, a load that was released before it settled, and a load during the rest of a scoped-recovery sync run record none. Coverage also ends when SQLite holds fewer rows for the demand than when it settled, for example after a source delete or Query DB retention expiry. A refetch: true load always waits for the network. An ordered window with a limit stays covered only while SQLite holds the same rows for it.

    A query that joins eager and on-demand sources becomes ready when every eager source is ready, which network-first allows from its restored rows after the deadline, and every demand the query reaches on an on-demand source has settled. A network failure alone does not settle an on-demand demand that is not covered.

    This applies only with the default single-process coordinator. With a multi-tab coordinator, such as BrowserCollectionCoordinator, on-demand loads still wait for the network.

  • Collections now answer two questions separately: can the data be shown (status), and is it still kept up to date (health). Once a query has shown data, a network or backend failure never takes it off the screen. (#2168)

    • status gains crashed: local storage broke (a closed IndexedDB connection, a failed SQLite persistence write or restore, a throwing sync function, or an invariant failure). Nothing recovers it in place, and reload() rejects. To recover, call cleanup({ dependents: true }), then start the Collection again (for example with preload()); it starts with no rows. It reaches every live query and Effect above it. error now means only "the first load failed".
    • Every Collection has collection.health, a health node with status, failureReason (the adapter is still trying), error (the adapter stopped, or the first load failed), reloading, and hasErrors. A live query's health has one node per source alias, in query order, and keeps object identity while unchanged. health:change fires when it changes. findProblems(health) lists the nodes that have a problem, in query order. Each problem (HealthProblem) shows its newest failure in message, cause, and at, and lists every failure still open in errors, oldest first: each reportError() of the sync run until reportHealthy(), or each failed request for more data on a live query's node. One error value is one failure: reporting it again changes nothing, and reportHealthy(error) removes just that failure, so a query Collection whose failing Query recovers removes only that Query's failures. After a live query is ready, a failed request for more data (a page, a joined row, or a source reload's replay of its data) is an error on the query's own node; the source stays healthy.
    • collection.reload() starts a new sync run and keeps the rows, status, and error on screen until the reload completes: when the new run's snapshot (begin({ snapshot: true })) or truncate() applies, or at its markReady(), which keeps the rows when no snapshot came. On a live query it reloads every Collection below it that shows an error, through nested live queries, then the query itself when its own node has an error, including a failed request for more data. It rejects on a crashed Collection. When the cleanup of the sync run that a reload retired rejects, the Collection crashes, also if the rejection comes later. A query in error stays there until its reload().
    • cleanup() rejects with CollectionHasSubscribersError while a live query with subscribers or an Effect reads the Collection. cleanup({ dependents: true }) ends them first. collection.subscribers lists every dependent.
    • A local-only Collection's reload() keeps its rows, including the user's writes: initialData loads only when the Collection starts, or starts again after cleanup.
    • Persisted Collections have one status. With initialRender: { strategy: 'network-first' }, restored rows make the Collection ready once the deadline passes or the remote fails; an empty restore stays loading. Only a local storage failure crashes a persisted Collection: a failed remote subset request is a failure reason, which the next successful remote request clears.

    Breaking changes and migration:

    BeforeAfter
    hook isErrorisLoadingError (first load failed) or isCrashed
    —isSyncError: ready and the health tree has a problem
    status: 'error' after a crashstatus: 'crashed'
    adapter markError(error)fail(error). After readiness it sets the node's error and keeps the rows. Later calls throw.
    cleanup() then preload() to recoverreload()
    adapter begin({ direct: true })begin(): every write applies on the rows the Collection holds, also during a reload
    a reload's first commit replaced every rowbegin({ snapshot: true }) or truncate() in the new run replaces them
    adapter markReady() after fail() threwit does nothing
    cleanup() while live queries or Effects read the Collectionrejects; unmount first or pass { dependents: true }
    persistedStatus, isPersistedReady, persistedError, preloadForInitialRender(), PERSISTED_READINESSstatus and health
    query-db utils.lastError, utils.isError, utils.errorCount, utils.clearError()collection.health, reload()
    infinite-query hooks' error (React, Preact, Vue, Svelte)the root node's error in health; fetchNextPage() still resolves

    Custom sync adapters: keep the run's readiness in your sync function. A reload calls sync again while collection.status still shows the previous run's status and the Collection still holds the previous run's rows. The new run's writes apply on those rows; it replaces every row only with a snapshot, a transaction begun with begin({ snapshot: true }), or with its own truncate(). The reload completes when that replacement applies, or at the new run's markReady(), which keeps the rows when no snapshot came. So send the new run's full state as a snapshot, or write against the kept rows: an insert of a key the Collection holds throws DuplicateKeySyncError, during a reload as at any time, so write update for a kept row, also from a replayed load after the reload completed. A reload keeps every row its new run does not rewrite: core never deletes kept rows on its own, so removing a row the backend deleted is the adapter's job, through a snapshot, a delete, or row ownership (#2269). An on-demand loadSubset result is partial and is never a snapshot. A live query's own reload keeps its rows and its window until its new run's result is complete. reportError() and reportHealthy() throw before the first markReady() and after fail(). markReady() after the run is ready, or after its fail(), does nothing, so an adapter needs no flag of its own to guard it. A second fail() in the same sync run does nothing. A first-ready callback that throws while sync runs is reported uncaught, and the Collection stays ready. reload() called from inside sync or a loadSubset call rejects, unless a reload is already in flight, whose promise it returns. Calls after a crash do nothing. For an on-demand Collection, a reload aborts the retired run's loadSubset calls and asks the new run's loadSubset for the current demand as soon as sync returns. Honor the signal: when core aborts a load, that load is over for core, and its later resolve or reject decides nothing, holds no readiness, and no replay waits for it. A loadSubset that throws synchronously is a rejection: a failed load, which requestSnapshot() and setWindow() report without throwing. A truncate's or reload's replay decides every request error of the query's demand: its success clears them all, and its failure replaces them with the replay's failures. useLiveSuspenseQuery now throws an Error for a failed first load or a crash: the cause itself when it is an Error, otherwise an Error with the problem's message whose cause holds the reported value.

Patch Changes

  • Fix type inference for schema-free collection options wrapped with persistedCollectionOptions and passed to createCollection. (#2259)

    Reject caller utilities that use the reserved local persistence names acceptMutations, getLeadershipState, or forceReloadSubset, instead of silently replacing them.

  • Keep a persisted Collection's status when another tab's commit reloads its rows. Before, a reload from durable rows could mark a tab ready while its own source was still loading, or move a tab whose initial sync failed from error to ready. Now only the Collection's own source changes its status. (#2265)

  • Keep a sync transaction that reserved its commit turn from failing when a persisted hydration starts while it is open. Before, only a subset load admitted during the reservation waited for the commit. A subset load admitted earlier, a reload or reset from a peer tab's notice, sequence-gap recovery, or a hydration that a shared scheduler held past its turn advanced the hydration cycle, and the commit then rejected with a persisted sync transaction cannot cross a hydration cycle. Electric reserves every stream transaction, so a deploy that made several tabs refetch at once could put their Collections into error. Each of these hydrations now waits outside the apply mutex until the reserved transaction commits, then starts. While it waits, readers keep the rows from before it. The reserveCommitTurn contract now covers every persisted hydration. (#2265)

    A peer reset now applies in arrival order with peer commit notices, so a commit from before the reset can no longer publish a row that the reset removed.

    Electric now abandons its open transaction when its stream stops for good, so hydrations that wait for that transaction can run.

    An abandoned reservation now releases the subset loads that waited for it, as a commit does, so they run. Before, a load admitted while the turn was reserved rejected with SyncTransactionAbortedError when the source abandoned the transaction.

  • Reloads no longer repeat setup that is already complete. A reopened persisted collection checks its tables, indexes, triggers, and bookkeeping rows in the same query that reads its registration, and runs its nine setup statements only when something is missing. Each adapter checks database-wide setup with one query and runs it only when a table, index, or migrated column is missing, instead of about 19 statements on every load. The write-only global schema_version row, which adapters with different schema versions overwrote on every load, is no longer created or written. (#2219)

    A tab no longer rereads all of a collection's rows after its own write. It used to record the write's stream position before that write's commit notice arrived, so the notice looked like a gap and triggered pullSince and a full row scan.

  • Add SQLiteConnectionClosedError. A browser OPFS connection now rejects requests made after close starts with this error instead of InvalidPersistedCollectionConfigError. (#2213)

  • Fix sync metadata reads that missed committed sync writes while an optimistic transaction held them. A sync source now reads its own writes in commit order: metadata.row.get, metadata.collection.get, and list() include committed transactions that have not applied yet, then the open transactions. A transaction begun inside an open one is independent, and a hold no longer changes commit order. A source insert over a different source row is a duplicate even when a seed or a hold is present. (#2262)

    Persisted collections treat cached rows as seeds, so a later DbClient seed can replace them, also after another tab's notice makes the collection reload from storage. A reload from another tab's notice keeps a seed accepted during a pending transaction, keeps row metadata of rows that do not exist, and keeps a seed's row metadata unless the notice names it. An update over a DbClient seed now stores the whole row the collection shows, so a reload or restart keeps the seed's fields. With rowUpdateMode: 'full', an update now replaces its stored row, so a reload or restart no longer brings back fields the update dropped. A reload deletes rows that storage lacks also while a pending transaction holds them. After a notice that requires a full reload, a later notice that names its rows keeps a seed's row metadata again. A schema reset from another tab clears every row and its metadata; in on-demand mode it keeps the DbClient seeds the collection holds and still replays demand. Rows that storage holds after a reset keep their metadata, and an equal re-insert of one keeps it too. A commit whose signal aborts before the persisted wrapper applies it no longer takes a DbClient seed's place. An insert in the persisted wrapper replaces the row it lands on and writes an insert mutation to storage. An equal re-insert keeps the row's metadata without writing it, and the wrapper no longer slows down quadratically with the size of a transaction.

  • Updated dependencies [5649a07, 43d4ef6, 7538afd, a07cd73, 6c1ca8f, 30175be, 4c39add, 1640de8, 367ea7c, 7d9ed02, 45eeef8]:

    • @tanstack/db@1.0.0-rc.1

0.4.12

Patch Changes

  • Keep a settled optimistic row visible while its server row waits behind an earlier persisted write. Previously, two quick writes to one row in a persisted Collection could briefly show the row before the second write. (#2208)

  • Updated dependencies [5a1b286, 9aecbab]:

    • @tanstack/db@0.15.2

0.4.11

Patch Changes

  • Show the right ordered window after an on-demand Query Collection refetches. When a refetch changes a page that has a later page after it, or moves a page's end earlier, a row could sort past the page's end and be in neither result. Query DB now reports that through the new sync-adapter call invalidateLoadedSubsets(), and each ordered live query and Effect re-establishes its window with a bounded repair. A window that lies inside its own first page, such as a top-N list after an insert, skips the repair. This covers utils.refetch() and Query refetches such as invalidateQueries. An ordering repair that overlaps in-flight page or tie work now reads a bounded prefix instead of the full source. The SQLite persistence wrapper forwards the new call. Ordered live queries also keep paging when a source answers a request synchronously from its cache, and a finished repair no longer leaves a second first page that every later refetch re-reads. (#2154)

  • Updated dependencies [468db85, 3c481f6, a09ba67, 92b11b0, fcd539a, 2c83fdc]:

    • @tanstack/db@0.15.1

0.4.10

Patch Changes

0.4.9

Patch Changes

  • Recover persisted on-demand Electric and Query collections after cache claim loss by rotating their SQLite cache and reloading active subsets. Fence retired provider work and expired claims, preserve warm runs on their claimed cache generation, and forward claim lifetime options through SQLite host factories. Require explicit eager or claim-bound managed targets for SQLite adapter data operations, and forward them through Electron IPC protocol v6. Bare collection IDs no longer work at this lower-level adapter boundary. (#2069)

  • 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. (#2096)

  • In a follower tab, an on-demand load that the leader fetches now settles only after the follower applies the leader's committed rows. Before, the leader's reply could settle the load while the follower was still applying the broadcast commit, so a live query in the follower tab could first be ready without those rows. A follower load now rejects, and releases its acquisition, when the leader's broadcast commit fails to apply in the follower, instead of settling without rows. (#2128)

    A follower now replaces its rows in place when it applies the leader's commits, instead of replaying its demand to a leader that commits again on every load. It also requests its demand again after the leader resets the collection, instead of showing an empty ready result. If its cache claim renewal fails transiently while a load waits for the leader's rows, the load rejects and the demand is retried, as after a failed request to the leader.

    Any persisted collection, not only a follower, now keeps commit notices that arrive while its cache claim is expired and applies them in arrival order once the claim is renewed or rotated; before, they were dropped. A commit that fails to apply from the queue now makes the collection fail, as a commit applied when it arrives already did.

  • Updated dependencies [cda9d6a, 2f928e6, dfec42e, 1a65c2c, 1b4ee8d, bbbf017, bc6f30e, fade2e2, bbe9327, b34a579, 6fa60aa, f84387c, be4a3d6, 0dc696a, fd13e3c]:

    • @tanstack/db@0.14.0

0.4.8

Patch Changes

  • Keep source-backed persisted Collections usable when a writer tab closes after a commit but before its reply. Certify the original transaction with the new writer and reload peers without duplicating unchanged row events. (#2088)

    Forward exact-ID reconciliation through the Electron persistence bridge and require matching protocol v4 peers.

  • Updated dependencies [f6aba31, faa3de6, bcb2af6, 2ab7f3e, 86f00ea, f7ac2c6, fa36267, 2c98b49, f6d65ea, fe284cc, 8b0e1de, 4bd66cf]:

    • @tanstack/db@0.13.0

0.4.7

Patch Changes

  • Updated dependencies [487c5a6]:
    • @tanstack/db@0.12.3

0.4.6

Patch Changes

0.4.5

Patch Changes

  • Fix stalled collection hydration when source transactions arrive during a SQLite hydration read. Ensure buffered transactions are durable before hydration completes. (#2049)

  • Preserve native Temporal.Instant and Temporal.PlainDate values in SQLite rows, metadata, replay, and expression indexes when Temporal constructors are registered globally. Retain nanosecond precision, calendar identity, and native literals in Collection index metadata. (#2039)

    Keep native index signatures distinct from ordinary tagged records, isolate mutable index metadata snapshots, and preserve NUL-bearing literals in SQLite expression indexes. Reuse each native query literal encoding for its order and identity.

    Validate remote subset admission without constructing discarded wire snapshots, while preserving fresh coordinator snapshots and the existing wire-value restrictions.

    Keep optional persisted index serialization failures inside existing warning boundaries so startup and ordinary reads remain available.

  • Preserve accepted sync transactions while they wait behind persisted reads, including transactions that began during an earlier read. Keep newer sync-adapter changes after the persisted baseline and preserve the order of truncate replay. (#2037)

  • Updated dependencies [d029833, aa1b58e, c3a4e4a, 2376eb5, a37e69a, d029833, d029833, de8d0f1]:

    • @tanstack/db@0.12.1

0.4.4

Patch Changes

  • Batch ordinary SQLite row and metadata writes, including repeated-key actions, to reduce storage calls while preserving mutation order and atomic commits. (#1999)

  • Keep SQLite subset queries within driver binding limits for large IN filters and Cloudflare Durable Object transactions. (#2000)

  • Preserve live-query results when SQLite predicate semantics differ from the row evaluator. Handle empty and single-argument boolean predicates with their expected identities. (#1997)

  • Drop a transaction's optimistic state when its mutation function settles. A sync transaction committed while the transaction is persisting is accepted and held. It publishes together with that drop, and isPersisted settles after that publication. A mutation function that returns before its server row arrives shows the previous synced row until that row applies. A sync write is attributed $origin: 'local' only if it was accepted before the optimistic state dropped. A sync transaction still open at that point is not counted. (#2030)

    Breaking: remove the begin({ immediate }) option from the sync API. Writes made while a mutation persists now queue behind it instead of applying at once.

    Each sync transaction now has two moments: accepted and visible. commit() receipts and subset loads resolve when the rows are visible. Collection readiness (preload, stateWhenReady, toArrayWhenReady) resolves once the startup rows are accepted, so a mutation handler that awaits its own collection's readiness during startup settles. An accepted transaction always applies. Handler-facing writes resolve at acceptance, so a mutation handler can await them: Query Collection direct writes, persisted mutation confirmation, and the PowerSync mutation path. A handler that awaits an on-demand load of its own collection waits for itself.

    A subset load whose caller aborts rejects with AbortError at every point: before the fetch, when the fetch fails because of the abort, after the fetch but before the commit, and between pages. Pages that were already accepted still apply, and a TrailBase load waits until they are visible.

    Query Collection direct writes read and validate the accepted rows and update the Query cache after acceptance. A refetch no longer cancels an accepted result, so overlapping refetches of a persisted collection apply in order (#1990). An eager fetch that started before a direct write keeps the server's rows for every key the write did not touch and the accepted row for each key it did, in both the collection and the Query cache.

    A DbClient hydration chunk is accepted ahead of a still-open source transaction, so readers of accepted rows see it and the source's commit() still commits its own writes.

    Partial sync updates now keep an own __proto__ field. Metadata-only sync writes no longer publish a spurious insert when they apply with a held transaction. A rollback keeps its delete event when a sync transaction for the same key is still open. When two completed transactions hold one key, the newer transaction's row stays visible. Canceling any sync transaction other than the open last one throws SyncQueueInvariantError.

  • Updated dependencies [2806da0, 7c516ce, eac6e8b, a21f4a4, cfb03f2]:

    • @tanstack/db@0.12.0

0.4.3

Patch Changes

  • Updated dependencies [06cab6f]:
    • @tanstack/db@0.11.3

0.4.2

Patch Changes

0.4.1

Patch Changes

0.4.0

Minor Changes

  • Add opt-in network-first initial rendering for eagerly persisted SQLite Collections. initialRender: { strategy: 'network-first', networkTimeoutMs } lets React and Solid Suspense render restored rows after the configured deadline (three seconds by default) or a network failure while sync continues. Live-query observers and the Angular, React, Solid, Svelte, and Vue integrations expose persistedStatus, isPersistedReady, and persistedError separately from Collection readiness. (#1955)

Patch Changes

0.3.0

Minor Changes

  • Preserve persisted resume integrity with atomic SQLite baseline evidence and stale-writer rejection, expose persistence sync metadata as one versioned capability, and refresh uncertified Electric baselines before publishing resumed data. (#1846)

    This changes the public persistence contracts: custom PersistenceAdapter implementations must now implement loadResumeSnapshot, and SyncMetadataApi.persistence is required with null explicitly representing no persistence. Custom sync wrappers that receive metadata must forward metadata.persistence unchanged so consumers receive either that sentinel or the complete versioned capability. A direct sync invocation may still omit the optional metadata object entirely, which consumers treat as no persistence. The Electron bridge now transports the atomic resume snapshot through IPC protocol v2; Electron main and renderer integrations must upgrade together because mixed v1/v2 peers fail closed. Node and React Native persistence instances that wrap one database handle now share transaction admission so concurrent collection startup cannot overlap transactions on that connection.

Patch Changes

  • Batch cold full-replacement SQLite writes to reduce worker round trips while preserving one atomic persisted transaction. Keep Cloudflare Durable Object batches within its 100-bound-parameter limit. (#1916)

  • Require coordinators to route complete committed transactions through the per-collection persistence owner, with named fail-stop errors for indeterminate commits and durability failures. Add clone-safe remote-subset leases with exact release, recursive wire validation, and matching Browser and Electron coordination. (#1845)

  • Wait for asynchronous adapter cleanup before a collection reaches cleaned-up or starts a replacement sync run. Preserve cleanup settlement through SQLite persistence, PowerSync, and Query Collection wrappers, including cleanup hooks acquired before cleanup starts and resource disposal failures. (#1895)

  • Request an existing leader's route before the first coordinated write, without sending the mutation. Let leader election finish during scheduled hydration, and reject writes queued under a former leader before persistence. (#1899)

  • Schedule ordinary persisted source commits before acquiring the browser writer lock, so they cannot deadlock with another Collection's hydration on a shared SQLite database. Add a real two-tab OPFS and live Electric recovery test for distinct schema versions and a torn legacy resume baseline. (#1910)

  • Retain retry-stable Suspense resources and preserve persisted demand readiness across lifecycle transitions. Avoid redundant Electric refreshes when requesting subset snapshots, and declare React 18 as the minimum supported React version. (#1860)

  • Fail-stop persisted collections when hydration or durability fails, and replay authoritative source transactions through one persistence-owned FIFO. Electric collections keep optimistic state immediate while surfacing durable failures through the collection error state instead of continuing from an incomplete baseline. (#1853)

    Query collections retain ownership metadata that the persisted wrapper already published instead of restoring stale ownership after the publication boundary.

  • Schedule complete SQLite hydration units fairly without holding coordinator work inside the local hydration scope. Fence stale startup rows after a coordinator reset. Preserve per-Collection leader adapter routing, mutation results across transport retries, terminal coordinator disposal, real-adapter restart order, and promise-discovered shared scheduling. (#1868)

  • Preserve explicit source aliases without changing legacy property paths. Compile SQLite expression-index queries consistently, rebuild affected stale physical indexes, and reject BigInts outside SQLite's signed 64-bit range. (#1867)

  • Preserve schema input and output inference when persisted collection options are passed to createCollection. Accept Expo's native SQLite database type and preserve transaction callback results while validating bind values against Expo's supported domain. (#1866)

  • Allow idempotent SQLite column migrations to recognize Tauri SQL duplicate-column errors returned as strings while continuing to reject unrelated migration failures. (#1900)

  • Updated dependencies [2ad6834, b528a61, 84fc44b, 9351f46, 5108acf, afbeb44, 2775082, fef53f8, b44a50a, 19dd9a2, 3096b8f, 1ab1cd3, e5fe2ea, 3eb5b2b, 7c62bf5, 63362dc, 7f6b643, c479fdc, 91a2cbf, 144c6b1, 5218f0c, 76d766e, 1e54c6a, d698b90, 04a1a81, 3ad64a4, 4c5a8de, b72b5d1, fc1adde, 2781581, 40a5aea, e16d46c, 9cbc885, 23ae52d, 7917ef9, 1ca838b, 34a999d, 825acc5, febd4bc, b7a7d10, 510cb53, efb84d8, 236d77b, 71ad428]:

    • @tanstack/db@0.10.0

0.2.23

Patch Changes

  • Updated dependencies [3c4c35d]:
    • @tanstack/db@0.9.2

0.2.22

Patch Changes

  • Harden Electric resume and lifecycle handling so partial updates cannot materialize unknown or moved-out rows, stale async work and waiters cannot cross cleanup or restart—including automatic garbage collection—and valid batches behave the same across callback partitions and persistence hydration. (#1785)

    Preserve hydrated baseline rows during persistence reloads, accept complete-row updates from explicit full-replica resumes, retain committed match evidence until reset, and restart persisted resumes when hydration completion cannot be verified.

    Replace stale cached rows atomically when an invalid resume falls back to a fresh snapshot. Keep subset acquisitions from restoring logically removed rows, and isolate utilities and tag visibility when collection options are reused while preserving compatible same-collection resume state.

    Accept partial updates to complete rows published independently by persistence, while preserving pending removal and reset boundaries. Avoid copying all applied keys at startup or each subset acquisition; presence checks overlay queued writes and buffered messages once per stream callback. Warn once when an older persistence adapter cannot verify hydration for safe resume.

    Keep buffered tag move-outs inside the progressive snapshot's existing transaction so later live updates are not discarded behind an orphaned truncate.

    Keep copied materialized configs and reentrant match callbacks scoped to their owning collection session. Cold tagged or legacy persisted state now recovers with a full snapshot behind cached rows, including in on-demand mode. Keep the reset marker through interrupted recovery and publish the replacement only after the full snapshot completes; known untagged and compatible warm resumes retain their saved offset.

  • Preserve native values, arbitrary class references, and draft cycles during mutation detachment; keep transaction persistence receipts settled after publication errors and avoid restoring an acknowledged direct insert over its server row. Keep a delete/reinsert visible when the old synced row has not yet been replaced. (#1800)

    Retire replaced ordered prefixes without interrupting successful-load bookkeeping if release throws. Retry automatic ordered repair at most twice while retaining stale results and exposing the error; cleanup cancels retries and explicit window retry remains available.

    Keep persisted acquisitions independent, avoid retaining one-shot refreshes as permanent demand, and reject upstream load failures without discarding cached rows. Restore PowerSync readiness only after the recovered baseline also removes rows deleted or moved outside active filters during the tracking outage.

  • Updated dependencies [a378bd3, ad043b7, 025a079, ddc129e]:

    • @tanstack/db@0.9.1

0.2.21

Patch Changes

  • Fix on-demand load settlement, ordered pagination, and replay to preserve coherent results across cancellation, failure, cleanup, and restart. Preserve subset results and ownership across Electric, PowerSync, Query, and SQLite persistence adapters. Correct live-query grouping, include projections, value identity, and indexed comparisons. D2 hashing now rejects structural cycles and excessive traversal depth or work with an explicit error; Collection handles retain object-reference identity without traversing their mutable contents. (#1797)

    Remove the unused public subset-algebra helpers: isWhereSubset, unionWherePredicates, minusWherePredicates, isOrderBySubset, isLimitSubset, isOffsetLimitSubset, isPredicateSubset, and isLoadSubsetRequestSubsumedBy. Apps that import these helpers must remove those imports; normal queries and adapters are unaffected. DeduplicatedLoadSubset remains available and shares only exact demand identities.

    Reject compiled Collection-valued includes as fn.select() inputs, including nested descendants, before invoking the callback. Use toArray() or materialize() in the upstream .select() for child-value calculations. To keep live child Collections, use expression .select() or perform parent-only functional work before adding the includes. Ordinary Collection-valued includes remain supported.

    Remove proxy DEBUG logging and automatic index timing statistics to avoid diagnostic work on reads and writes. Remove getStats() and IndexStats; use index.keyCount for the current entry count, and instrument index methods externally when profiling. Custom index subclasses must remove calls to the retired trackLookup() and updateTimestamp() helpers.

    Fix mutation drafts so Map/Set forEach calls each callback once and read-only iteration reports no changes. Track nested Map for...of edits through collection.update(). Keep Set entries in place during nested edits, preserving live iteration and usable has, delete, and add handles without duplicate entries or repeated visits. Reverting one entry no longer discards another entry's pending changes.

    Preserve shared values within a row's draft. Newly supplied objects use normal shared references during the update callback, including Map values and Set members; editing through either handle changes the same new object. Copy completed changes at callback return so later caller edits cannot mutate stored data. Existing collection values remain isolated. Copy a new caller-owned value before insertion if it must remain untouched during the callback.

    Keep rejected local-storage mutations out of later successful saves. Stage insert, update, delete, and manual transaction writes before persisting, then promote the shared cache only after storage succeeds.

    Deliver live-query observer publications to peer listeners even when one listener throws. Preserve queued publication order and stop delivery on disposal; report the first listener failure after delivery.

    Wait for PowerSync demands admitted during tracking finalization before reporting them loaded. Preserve untouched object and array key identity when they contain NaN. Retire every failed ordered acquisition on explicit retry, while retaining a full-source demand repaired by replay.

    After authoritative ordered recovery succeeds, retire settled page and tie demands so later truncate replay fetches only the full-source replacement. Keep unfinished requests observed until settlement and preserve independent query ownership.

    Remove the live-query utils.getRunCount() diagnostic and its runtime counter. Apps that call this diagnostic must remove those calls. Query scheduling and results are unchanged.

    Remove test-only index inspection getters (indexedKeysSet, valueMapData, orderedEntriesArray, and orderedEntriesArrayReversed) and unused scheduler diagnostics. ReverseIndex now exposes only the IndexReader lookup, range, and forward traversal surface returned by findIndexForField; mutate the original index instead. Export IndexReader for callers that name this return type. Remove the unused subscription releaseLoadSubset() method; request owners use the release callback supplied by onLoadSubsetResult. Ordinary query and adapter APIs remain unchanged by these removals.

    Remove unused internal helpers and the unused public error classes WhereClauseConversionError, SubscriptionNotFoundError, and AggregateNotSupportedError. These classes have no remaining runtime throw sites; remove any imports of them. Keep the existing query and index behavior and exercise identity/evaluation tests through the production entry points.

    Ensure failed mutations roll back even when their rejection value cannot be converted to a string. Preserve ordinary Error instances; report unprintable rejection values as Unknown error.

    Make reentrant effect disposal share the active cleanup result, including calls from abort listeners or source release callbacks. A release failure reaches every waiting disposer while each source still receives one release attempt.

    Reject starting or preloading a collection from inside its active cleanup callbacks with a clear CollectionStateError. Nested cleanup cannot admit replacement work that the old teardown would discard. Restart after cleanup completes, or from its final cleaned-up status event, remains supported.

    Prevent older page or tie-boundary completions from clearing a newer full-source failure or starting redundant loading. Failed window moves retain their settled public snapshot; an explicit retry releases the failed acquisition once and publishes the completed replacement.

    Restrict direct subscription requestLimitedSnapshot() cursor inputs to one order term and one minValues entry. Composite and partial-composite cursor inputs now throw before local delivery or adapter work. Use normal live-query ordering and window APIs for multi-column pagination; those remain supported through prefix-and-tie loading. Existing adapters need no changes.

    Treat LoadSubsetOptions and their nested request data as immutable from submission onward. Core no longer copies expression trees or mutable constant payloads at the sync and deduplication boundaries. Create a new Date, byte array, membership array, or options object when changing a demand instead of mutating submitted data. Adapters must also leave request data unchanged. Use stable data properties rather than stateful getters. AbortSignal cancellation and subscription release remain live.

    Replace replay acquisitions sequentially: release the prior physical lease before starting its replacement. The logical demand and last complete public result remain retained. A failed release prevents replacement startup; failed startup leaves demand available for a later authoritative replay. Custom adapters must support a release/load gap and preserve resources still held by other owners; a sole underlying resource may stop and restart.

  • Updated dependencies [cfb01ce]:

    • @tanstack/db@0.9.0

0.2.20

Patch Changes

  • Updated dependencies [bbc9edf]:
    • @tanstack/db@0.8.7

0.2.19

Patch Changes

  • Updated dependencies [ae2fe74]:
    • @tanstack/db@0.8.6

0.2.18

Patch Changes

  • Settle subset loads only after their committed rows and events are visible. A (#1769) commit receipt now rejects with AbortError when cancellation wins before application and ignores later aborts. Preserve causal publication, cancellation, persistence, and error handling across the affected sync adapters.
  • Updated dependencies [d8defd2, 9ad882f, 8c5838d]:
    • @tanstack/db@0.8.5

0.2.17

Patch Changes

0.2.16

Patch Changes

0.2.15

Patch Changes

  • Updated dependencies [c521b5d]:
    • @tanstack/db@0.8.2

0.2.14

Patch Changes

0.2.13

Patch Changes

  • Add SSR through request-scoped DbClient instances, collection descriptors, (#1564) explicit collection-row hydration, live-query result snapshots, adapter sync metadata, and React and Svelte descriptor resolution.

    React live queries now derive identity from structured query IR. Opaque queries can provide queryKey; legacy dependency arrays and unkeyed opaque queries keep working with development warnings until 1.0.

    Add TanStack Router integration that streams live queries discovered during a Suspense render as pending promises which resolve to ordered result snapshots. The browser starts normal source sync and atomically replaces the snapshot when its live result is ready.

  • Updated dependencies [4b9e8cd]:

    • @tanstack/db@0.8.0

0.2.12

Patch Changes

  • Updated dependencies [5f63996]:
    • @tanstack/db@0.7.2

0.2.11

Patch Changes

  • Updated dependencies [424382b]:
    • @tanstack/db@0.7.1

0.2.10

Patch Changes

0.2.9

Patch Changes

  • Updated dependencies [8ee783d]:
    • @tanstack/db@0.6.17

0.2.8

Patch Changes

0.2.7

Patch Changes

0.2.6

Patch Changes

  • Fixed bug where internal metadata would get reset on insert causing stale items to remain (#1626)

  • Updated dependencies [397e12a]:

    • @tanstack/db@0.6.14

0.2.5

Patch Changes

0.2.4

Patch Changes

  • Updated dependencies [2b27dd1]:
    • @tanstack/db@0.6.12

0.2.3

Patch Changes

0.2.2

Patch Changes

  • Updated dependencies [307fdf8]:
    • @tanstack/db@0.6.10

0.2.1

Patch Changes

  • Use a safe randomUUID helper that falls back to crypto.getRandomValues when crypto.randomUUID is unavailable (non-secure browser contexts such as dev servers reached via a LAN IP over HTTP). Fixes #1541. (#1593)

  • Updated dependencies [2147345, 00389a4]:

    • @tanstack/db@0.6.9

0.2.0

Minor Changes

  • SQLite persistence wrappers now prune the applied_tx replay log by default so SQLite files no longer grow without bound. When prune options are omitted, wrappers that construct the shared SQLite core adapter apply appliedTxPruneMaxRows: 1_000 and appliedTxPruneMaxAgeSeconds: 86_400 (24h). Both remain overridable, and passing 0 disables that limit. The defaults are exported as DEFAULT_APPLIED_TX_PRUNE_MAX_ROWS and DEFAULT_APPLIED_TX_PRUNE_MAX_AGE_SECONDS from the shared SQLite core package and re-exported by wrapper packages. (#1572)

    The shared SQLite core adapter now treats applied_tx as a bounded replay cache during pullSince recovery. If a recovery request starts before the retained replay window, pullSince returns requiresFullReload: true instead of returning partial deltas.

Patch Changes

  • Updated dependencies [3827b62]:
    • @tanstack/db@0.6.8

0.1.11

Patch Changes

0.1.10

Patch Changes

  • Updated dependencies [4e9ab39]:
    • @tanstack/db@0.6.6

0.1.9

Patch Changes

0.1.8

Patch Changes

  • Updated dependencies [1e69dd6]:
    • @tanstack/db@0.6.4

0.1.7

Patch Changes

0.1.6

Patch Changes

0.1.5

Patch Changes

  • Updated dependencies [8b7fb1a]:
    • @tanstack/db@0.6.1

0.1.4

Patch Changes

  • Fix workspace: dependency links that were incorrectly published to npm (#1410)

0.1.3

Patch Changes

  • Fix workspace: dependency links that were incorrectly published to npm (#1408)

0.1.2

Patch Changes

  • Fix workspace: dependency links that were incorrectly published to npm (#1406)

0.1.1

Patch Changes

  • fix(persistence): harden persisted startup, truncate metadata semantics, and resume identity matching (#1380)

    • Restore persisted wrapper markReady fallback behavior so startup failures do not leave collections stuck in loading state
    • Replace load cancellation reference identity tracking with deterministic load keys for loadSubset / unloadSubset
    • Document intentional truncate behavior where collection-scoped metadata writes are preserved across truncate transactions
    • Tighten SQLite applied_tx migration handling to only ignore duplicate-column add errors
    • Stabilize Electric shape identity serialization so persisted resume compatibility does not depend on object key insertion order
  • feat(persistence): add SQLite-based offline persistence for collections (#1358)

    Adds a new persistence layer that durably stores collection data in SQLite, enabling applications to survive page reloads and app restarts across browser, Node, mobile, desktop, and edge runtimes.

    Core persistence (@tanstack/db-sqlite-persistence-core)

    • New package providing the shared SQLite persistence runtime: hydration, streaming, transaction tracking, and applied-tx pruning
    • SQLite core adapter with full query compilation, index management, and schema migration support
    • Portable conformance test contracts for runtime-specific adapters

    Browser (@tanstack/browser-db-sqlite-persistence)

    • New package for browser persistence via wa-sqlite backed by OPFS
    • Single-tab persistence with OPFS-based SQLite storage
    • BrowserCollectionCoordinator for multi-tab leader-election and cross-tab sync

    Cloudflare Durable Objects (@tanstack/cloudflare-durable-objects-db-sqlite-persistence)

    • New package for SQLite persistence in Cloudflare Durable Objects runtimes

    Node (@tanstack/node-db-sqlite-persistence)

    • New package for Node persistence via SQLite

    Electron (@tanstack/electron-db-sqlite-persistence)

    • New package providing Electron main and renderer persistence bridge helpers

    Expo (@tanstack/expo-db-sqlite-persistence)

    • New package for Expo persistence via expo-sqlite

    React Native (@tanstack/react-native-db-sqlite-persistence)

    • New package for React Native persistence via op-sqlite
    • Adapter with transaction deadlock prevention and runtime parity coverage

    Capacitor (@tanstack/capacitor-db-sqlite-persistence)

    • New package for Capacitor persistence via @capacitor-community/sqlite

    Tauri (@tanstack/tauri-db-sqlite-persistence)

    • New package for Tauri persistence via @tauri-apps/plugin-sql
  • Updated dependencies [f60384b, b8abc02, 09c7afc, bb09eb1, 179d666, 43ecbfa, 055fd94, 055fd94, 055fd94, 055fd94, 85f5435, b65d8f7, e0df07e, 9952921, d351c67]:

    • @tanstack/db@0.6.0