Repository navigation
@tanstack/electric-db-collection@0.6.0
Minor Changes
-
A stream error that
onErrorretries no longer fails the initial sync or the subset loads that are waiting for it. The collection staysloadingwhileonErrordecides, and waiting loads settle when the retried stream delivers its snapshot. Before, the collection enterederrorand waiting loads rejected even when the retry succeeded, which could leave a joined or included live query in error for good. A stream error withoutonError, or one whereonErrorgives up or throws, still fails the initial sync and its waiting loads. The initial sync also fails when the Electric client gives up by itself afteronErrorasked for a retry, for example on a response without Electric headers or after its retry limit, and when the stream's externalsignalaborts before the first ready. Before, the collection stayedloadingin both cases. When the initial sync fails, waiting loads and readiness waits such aspreload()now reject with the same cause, including whenonErrorthrows. A status listener that cleans the Collection up while it enterserrorno longer makes a waiting load succeed without rows. Once the first up-to-date is committed, its persistence step alone decides the initial sync: the Collection becomes ready when that snapshot is accepted, even after a retry or a give-up, and fails with the persistence error when it is not. (#2127)Migration note: while
onErrordecides whether to retry, the Collection now staysloading, andpreload()and other readiness waits stay pending. Before, they enterederrorand rejected at once, even when the retry later succeeded. Code that showed a reconnecting state onstatus === 'error'during a retry should readonErroritself instead.
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)
-
A live query over a progressive Electric collection is now ready once its own snapshot loads. Before, it stayed loading until the collection's background full sync completed, so
preload(),isReady, anduseLiveSuspenseQuerywaited for the whole dataset even when the query's rows were already present. A live query now waits for an eager source to be ready and for an on-demand source's subset loads to settle. An on-demand source's own readiness no longer gates the query. (#2115)An effect with
skipInitial: trueends its initial suppression at the same point. Before, an effect over an on-demand source that was already ready reported its initial rows asenterevents.A live query no longer enters an error state when a truncate of a lazily loaded source (a joined or included collection) aborts that source's pending load during the initial load. The truncate's replacement load now decides the demand.
A progressive Electric load that arrives while a must-refetch is replacing the initial snapshot now settles when the replacement completes. Before, it settled at once without loading rows, which the new readiness rule would have reported as a ready, empty query. After a stream error that
onErrorretries, later progressive loads settle once the stream recovers.toArrayWhenReady()andstateWhenReady()now resolve whenpreload()does. Before, they resolved as soon as the collection held any row, so on a live query they could resolve before the query was ready. -
Updated dependencies [
cda9d6a,2f928e6,dfec42e,1a65c2c,1b4ee8d,bbbf017,bc6f30e,fade2e2,bbe9327,b34a579,6fa60aa,f84387c,be4a3d6,0dc696a,fd13e3c]:- @tanstack/db@0.14.0