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

CHANGELOG.md

836 lines50.5 KB

@tanstack/rxdb-db-collection

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

  • 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

0.1.111

Patch Changes

0.1.110

Patch Changes

0.1.109

Patch Changes

0.1.108

Patch Changes

0.1.107

Patch Changes

0.1.106

Patch Changes

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

0.1.105

Patch Changes

0.1.104

Patch Changes

0.1.103

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.

  • Update RxDB to 17.1.0 and require RxDB 17 or newer. Applications using RxDB 16 must upgrade RxDB before updating this adapter. (#1482)

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

    • @tanstack/db@0.12.0

0.1.102

Patch Changes

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

0.1.101

Patch Changes

0.1.100

Patch Changes

0.1.99

Patch Changes

0.1.98

Patch Changes

0.1.97

Patch Changes

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

0.1.96

Patch Changes

0.1.95

Patch Changes

  • Updated dependencies [cfb01ce]:
    • @tanstack/db@0.9.0

0.1.94

Patch Changes

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

0.1.93

Patch Changes

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

0.1.92

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.1.91

Patch Changes

0.1.90

Patch Changes

0.1.89

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.88

Patch Changes

0.1.87

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.1.86

Patch Changes

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

0.1.85

Patch Changes

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

0.1.84

Patch Changes

0.1.83

Patch Changes

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

0.1.82

Patch Changes

0.1.81

Patch Changes

0.1.80

Patch Changes

  • Updated dependencies [397e12a]:
    • @tanstack/db@0.6.14

0.1.79

Patch Changes

0.1.78

Patch Changes

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

0.1.77

Patch Changes

0.1.76

Patch Changes

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

0.1.75

Patch Changes

0.1.74

Patch Changes

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

0.1.73

Patch Changes

0.1.72

Patch Changes

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

0.1.71

Patch Changes

0.1.70

Patch Changes

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

0.1.69

Patch Changes

0.1.68

Patch Changes

0.1.67

Patch Changes

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

0.1.66

Patch Changes

0.1.65

Patch Changes

  • Updated dependencies [c3e6a96]:
    • @tanstack/db@0.5.33

0.1.64

Patch Changes

0.1.63

Patch Changes

  • Updated dependencies [bf1d078]:
    • @tanstack/db@0.5.31

0.1.62

Patch Changes

  • Updated dependencies [e9d0fd8]:
    • @tanstack/db@0.5.30

0.1.61

Patch Changes

0.1.60

Patch Changes

  • Updated dependencies [46450e7]:
    • @tanstack/db@0.5.28

0.1.59

Patch Changes

0.1.58

Patch Changes

0.1.57

Patch Changes

0.1.56

Patch Changes

  • Updated dependencies [7099459]:
    • @tanstack/db@0.5.24

0.1.55

Patch Changes

  • Updated dependencies [05130f2]:
    • @tanstack/db@0.5.23

0.1.54

Patch Changes

  • Updated dependencies [f9b741e]:
    • @tanstack/db@0.5.22

0.1.53

Patch Changes

0.1.52

Patch Changes

  • Updated dependencies []:
    • @tanstack/db@0.5.20

0.1.51

Patch Changes

0.1.50

Patch Changes

  • Updated dependencies [c1247e8]:
    • @tanstack/db@0.5.18

0.1.49

Patch Changes

0.1.48

Patch Changes

  • Updated dependencies [41308b8]:
    • @tanstack/db@0.5.16

0.1.47

Patch Changes

  • Updated dependencies [32ec4d8]:
    • @tanstack/db@0.5.15

0.1.46

Patch Changes

  • Updated dependencies [26ed0aa]:
    • @tanstack/db@0.5.14

0.1.45

Patch Changes

0.1.44

Patch Changes

0.1.43

Patch Changes

0.1.42

Patch Changes

0.1.41

Patch Changes

  • Updated dependencies [5f474f1]:
    • @tanstack/db@0.5.9

0.1.40

Patch Changes

0.1.39

Patch Changes

  • Updated dependencies [295cb45]:
    • @tanstack/db@0.5.7

0.1.38

Patch Changes

  • Updated dependencies [c8a2c16]:
    • @tanstack/db@0.5.6

0.1.37

Patch Changes

  • Updated dependencies [077fc1a]:
    • @tanstack/db@0.5.5

0.1.36

Patch Changes

0.1.35

Patch Changes

0.1.34

Patch Changes

  • Updated dependencies [99a3716]:
    • @tanstack/db@0.5.2

0.1.33

Patch Changes

  • Updated dependencies [a83a818]:
    • @tanstack/db@0.5.1

0.1.32

Patch Changes

0.1.31

Patch Changes

0.1.30

Patch Changes

  • Updated dependencies [75470a8]:
    • @tanstack/db@0.4.19

0.1.29

Patch Changes

0.1.28

Patch Changes

  • Updated dependencies [49bcaa5]:
    • @tanstack/db@0.4.17

0.1.27

Patch Changes

0.1.26

Patch Changes

  • Updated dependencies [6738247]:
    • @tanstack/db@0.4.15

0.1.25

Patch Changes

  • Updated dependencies [970616b]:
    • @tanstack/db@0.4.14

0.1.24

Patch Changes

  • Updated dependencies [3c9526c]:
    • @tanstack/db@0.4.13

0.1.23

Patch Changes

0.1.22

Patch Changes

  • Updated dependencies [5566b26]:
    • @tanstack/db@0.4.11

0.1.21

Patch Changes

0.1.20

Patch Changes

  • Addressed the majority of "any" type usage in the rxdb-db-collection adapter as well as fixed querying for documents where _deleted is false, which fixes issues when using localStorage or other persistent storage mechanisms. (#667)

  • Updated dependencies [e52be92, 4a7c44a, ee61bb6]:

    • @tanstack/db@0.4.9

0.1.19

Patch Changes

0.1.18

Patch Changes

  • Updated dependencies [6692aad]:
    • @tanstack/db@0.4.7

0.1.17

Patch Changes

0.1.16

Patch Changes

  • Updated dependencies [7556fb6]:
    • @tanstack/db@0.4.5

0.1.15

Patch Changes

0.1.14

Patch Changes

  • Updated dependencies [32f2212]:
    • @tanstack/db@0.4.3

0.1.13

Patch Changes

0.1.12

Patch Changes

  • Updated dependencies [8cd0876]:
    • @tanstack/db@0.4.1

0.1.11

Patch Changes

  • Refactor the main Collection class into smaller classes to make it easier to maintain. (#560)

  • Updated dependencies [2f87216, ac6250a, 2f87216]:

    • @tanstack/db@0.4.0

0.1.10

Patch Changes

  • Updated dependencies [cacfca2]:
    • @tanstack/db@0.3.2

0.1.9

Patch Changes

  • Updated dependencies [5f51f35]:
    • @tanstack/db@0.3.1

0.1.8

Patch Changes

0.1.7

Patch Changes

0.1.6

Patch Changes

0.1.5

Patch Changes

  • Initial release (#533)

0.0.0

  • Initial Release