@tanstack/powersync-db-collection#
0.2.8#
Patch Changes#
- Updated dependencies [
487c5a6]:- @tanstack/db@0.12.3
0.2.7#
Patch Changes#
0.2.6#
Patch Changes#
- Updated dependencies [
d029833,aa1b58e,c3a4e4a,2376eb5,a37e69a,d029833,d029833,de8d0f1]:- @tanstack/db@0.12.1
0.2.5#
Patch Changes#
Add development-only collection configuration diagnostics. Missing or invalid core options throw actionable errors. Extra adapter properties remain accepted without warnings, except for likely misspellings: casing mistakes or adjacent letter swaps in option names with at least five characters. A suggestion is suppressed when the correctly named option is already present. Keep the validator, warnings, and internal diagnostic classes out of production application bundles. (#1278)
Keep adapter-specific options inside PowerSync, RxDB, and TrailBase. Update the adapter guide to keep conversions in adapter code and place rowUpdateMode inside the sync config.
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
isPersistedsettles 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
AbortErrorat 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 throwsSyncQueueInvariantError.Updated dependencies [
2806da0,7c516ce,eac6e8b,a21f4a4,cfb03f2]:- @tanstack/db@0.12.0
0.2.4#
Patch Changes#
- Updated dependencies [
06cab6f]:- @tanstack/db@0.11.3
0.2.3#
Patch Changes#
- Updated dependencies [
dac687d,dac687d,dac687d,dac687d,7595a2d,dac687d,dac687d,8be6705]:- @tanstack/db@0.11.2
0.2.2#
Patch Changes#
- Updated dependencies [
a18f63d,e706483,18abcee,d2690bf,5b85af0,1dbf5f9,7ab48d8,d2690bf,7ca38db,f2f92c5]:- @tanstack/db@0.11.1
0.2.1#
Patch Changes#
- Updated dependencies [
9c62ac3,d5e4732,0122da8,f7d96f7,fb509ef,dc4b4e0,f158258,c879ba6,b5d92ce]:- @tanstack/db@0.11.0
0.2.0#
Minor Changes#
- Require PowerSync 2 and fix update conservation, declared-view rows, transformed-schema comparison, and portable inferred declarations. (#1831)
Patch Changes#
Wait for asynchronous adapter cleanup before a collection reaches
cleaned-upor 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)Separate cleanup start from settlement so dependent live queries and Effects become terminal when a source Collection starts cleanup. Keep PowerSync cleanup pending until late load-hook and trigger cleanup work settles. (#1897)
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.1.69#
Patch Changes#
- Updated dependencies [
3c4c35d]:- @tanstack/db@0.9.2
0.1.68#
Patch Changes#
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.1.67#
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, andisLoadSubsetRequestSubsumedBy. Apps that import these helpers must remove those imports; normal queries and adapters are unaffected.DeduplicatedLoadSubsetremains available and shares only exact demand identities.Reject compiled Collection-valued includes as
fn.select()inputs, including nested descendants, before invoking the callback. UsetoArray()ormaterialize()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
DEBUGlogging and automatic index timing statistics to avoid diagnostic work on reads and writes. RemovegetStats()andIndexStats; useindex.keyCountfor the current entry count, and instrument index methods externally when profiling. Custom index subclasses must remove calls to the retiredtrackLookup()andupdateTimestamp()helpers.Fix mutation drafts so Map/Set
forEachcalls each callback once and read-only iteration reports no changes. Track nested Mapfor...ofedits throughcollection.update(). Keep Set entries in place during nested edits, preserving live iteration and usablehas,delete, andaddhandles 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, andorderedEntriesArrayReversed) and unused scheduler diagnostics.ReverseIndexnow exposes only theIndexReaderlookup, range, and forward traversal surface returned byfindIndexForField; mutate the original index instead. ExportIndexReaderfor callers that name this return type. Remove the unused subscriptionreleaseLoadSubset()method; request owners use the release callback supplied byonLoadSubsetResult. Ordinary query and adapter APIs remain unchanged by these removals.Remove unused internal helpers and the unused public error classes
WhereClauseConversionError,SubscriptionNotFoundError, andAggregateNotSupportedError. 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 finalcleaned-upstatus 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 oneminValuesentry. 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
LoadSubsetOptionsand 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.AbortSignalcancellation 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.1.66#
Patch Changes#
- Updated dependencies [
bbc9edf]:- @tanstack/db@0.8.7
0.1.65#
Patch Changes#
- Updated dependencies [
ae2fe74]:- @tanstack/db@0.8.6
0.1.64#
Patch Changes#
- Settle subset loads only after their committed rows and events are visible. A (#1769)
commit receipt now rejects with
AbortErrorwhen 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.1.63#
Patch Changes#
0.1.62#
Patch Changes#
0.1.61#
Patch Changes#
Propagate initial query sync failures through dependent live queries and readiness promises, including recovery and late subscribers, while preserving a ready cached snapshot on later refetch failures. Let sync adapters pass the original failure to
markError(error)so readiness promises reject with that cause. Isolate adapter callbacks by sync session, preserve synchronous startup errors, and prevent rejected deduplicated subset requests from creating detached promise rejections. (#1751)Updated dependencies [
c521b5d]:- @tanstack/db@0.8.2
0.1.60#
Patch Changes#
Rebuild correlated include materialization as one D2 graph, fixing stale or missing nested results across route changes, batching, lazy loading, optimistic updates, and layered queries. Add canonical structural relation keys, abortable subset demand, and coherent publication for Collection-valued includes. Dispose delayed PowerSync subset hooks after cleanup, and prevent released Query Collection cache results from reaching the collection. (#1740)
Updated dependencies [
5d9335d,a20352a]:- @tanstack/db@0.8.1
0.1.59#
Patch Changes#
Add SSR through request-scoped
DbClientinstances, 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.1.58#
Patch Changes#
- Updated dependencies [
5f63996]:- @tanstack/db@0.7.2
0.1.57#
Patch Changes#
- Updated dependencies [
424382b]:- @tanstack/db@0.7.1
0.1.56#
Patch Changes#
Fixed
no such tableerrors logged by theon-demandsync handler. Records are no longer flushed before thediffTriggerhas been set up, and the tracking state is now cleared as part of disposal so unloading a subset or cleaning up the collection no longer flushes the dropped tracking table. (#1585)Fix: applyTransaction hangs forever when a transaction mixes delete+insert on one collection for a same-millisecond tie. (#1649)
Updated dependencies [
ad88d07,7e7abda,dc53f0e]:- @tanstack/db@0.7.0
0.1.55#
Patch Changes#
- Updated dependencies [
8ee783d]:- @tanstack/db@0.6.17
0.1.54#
Patch Changes#
0.1.53#
Patch Changes#
0.1.52#
Patch Changes#
- Updated dependencies [
397e12a]:- @tanstack/db@0.6.14
0.1.51#
Patch Changes#
0.1.50#
Patch Changes#
- Updated dependencies [
2b27dd1]:- @tanstack/db@0.6.12
0.1.49#
Patch Changes#
0.1.48#
Patch Changes#
- Updated dependencies [
307fdf8]:- @tanstack/db@0.6.10
0.1.47#
Patch Changes#
0.1.46#
Patch Changes#
- Updated dependencies [
3827b62]:- @tanstack/db@0.6.8
0.1.45#
Patch Changes#
0.1.44#
Patch Changes#
Fixed bug where on-demand collections with the
idcolumn in their where clause would never be added to the PowerSync upload queue. (#1470)Updated dependencies [
4e9ab39]:- @tanstack/db@0.6.6
0.1.43#
Patch Changes#
0.1.42#
Patch Changes#
- Updated dependencies [
1e69dd6]:- @tanstack/db@0.6.4
0.1.41#
Patch Changes#
0.1.40#
Patch Changes#
0.1.39#
Patch Changes#
- Updated dependencies [
8b7fb1a]:- @tanstack/db@0.6.1
0.1.38#
Patch Changes#
Added 'on-demand'
syncModeoption which makes the collection work with a query-driven sync approach. (#1356)Update dependencies across workspace to resolve version mismatches:
@electric-sql/client^1.5.13,@tanstack/store^0.9.2,pg^8.20.0. Adapt subscription cleanup to@tanstack/store0.9.x API which returnsSubscriptionobjects instead of unsubscribe functions. (#1381)Updated dependencies [
f60384b,b8abc02,09c7afc,bb09eb1,179d666,43ecbfa,055fd94,055fd94,055fd94,055fd94,85f5435,b65d8f7,e0df07e,9952921,d351c67]:- @tanstack/db@0.6.0
0.1.37#
Patch Changes#
- Updated dependencies [
c3e6a96]:- @tanstack/db@0.5.33
0.1.36#
Patch Changes#
0.1.35#
Patch Changes#
- Updated dependencies [
bf1d078]:- @tanstack/db@0.5.31
0.1.34#
Patch Changes#
- Updated dependencies [
e9d0fd8]:- @tanstack/db@0.5.30
0.1.33#
Patch Changes#
0.1.32#
Patch Changes#
- Updated dependencies [
46450e7]:- @tanstack/db@0.5.28
0.1.31#
Patch Changes#
Make type of collection utils more precise for localOnly, PowerSync, Trailbase, and Electric collections (#1236)
Updated dependencies [
802550f,dc41d7d,4ff3da5,2223cd6]:- @tanstack/db@0.5.27
0.1.30#
Patch Changes#
0.1.29#
Patch Changes#
0.1.28#
Patch Changes#
- Updated dependencies [
7099459]:- @tanstack/db@0.5.24
0.1.27#
Patch Changes#
- Updated dependencies [
05130f2]:- @tanstack/db@0.5.23
0.1.26#
Patch Changes#
- Updated dependencies [
f9b741e]:- @tanstack/db@0.5.22
0.1.25#
Patch Changes#
0.1.24#
Patch Changes#
- Updated dependencies []:
- @tanstack/db@0.5.20
0.1.23#
Patch Changes#
0.1.22#
Patch Changes#
- Updated dependencies [
c1247e8]:- @tanstack/db@0.5.18
0.1.21#
Patch Changes#
Added support for tracking collection operation metadata in PowerSync CrudEntry operations. (#999)
// Schema config const APP_SCHEMA = new Schema({ documents: new Table( { name: column.text, created_at: column.text, }, { // Metadata tracking must be enabled on the PowerSync table trackMetadata: true, }, ), }) // ... Other config // Collection operations which specify metadata await collection.insert( { id, name: `document`, }, // The string version of this will be present in PowerSync `CrudEntry`s during uploads { metadata: { extraInfo: 'Info', }, }, )Updated dependencies [
f795a67,d542667,6503c09,b1cc4a7]:- @tanstack/db@0.5.17
0.1.20#
Patch Changes#
- Updated dependencies [
41308b8]:- @tanstack/db@0.5.16
0.1.19#
Patch Changes#
- Updated dependencies [
32ec4d8]:- @tanstack/db@0.5.15
0.1.18#
Patch Changes#
- Updated dependencies [
26ed0aa]:- @tanstack/db@0.5.14
0.1.17#
Patch Changes#
0.1.16#
Patch Changes#
0.1.15#
Patch Changes#
0.1.14#
Patch Changes#
0.1.13#
Patch Changes#
- Updated dependencies [
5f474f1]:- @tanstack/db@0.5.9
0.1.12#
Patch Changes#
0.1.11#
Patch Changes#
- Updated dependencies [
295cb45]:- @tanstack/db@0.5.7
0.1.10#
Patch Changes#
- Updated dependencies [
c8a2c16]:- @tanstack/db@0.5.6
0.1.9#
Patch Changes#
- Updated dependencies [
077fc1a]:- @tanstack/db@0.5.5
0.1.8#
Patch Changes#
0.1.7#
Patch Changes#
0.1.6#
Patch Changes#
- Updated dependencies [
99a3716]:- @tanstack/db@0.5.2
0.1.5#
Patch Changes#
- Updated dependencies [
a83a818]:- @tanstack/db@0.5.1
0.1.4#
Patch Changes#
- Updated dependencies [
243a35a,f9d11fc,7aedf12,28f81b5,28f81b5,f6ac7ea,01093a7]:- @tanstack/db@0.5.0
0.1.3#
Patch Changes#
0.1.2#
Patch Changes#
- Updated dependencies [
75470a8]:- @tanstack/db@0.4.19
0.1.1#
Patch Changes#
0.1.0#
Minor Changes#
- Initial Release (#747)
Patch Changes#
- Updated dependencies [
49bcaa5]:- @tanstack/db@0.4.17