Defined in: packages/db/src/live-query-observer.ts:70
Internal
Wraps a resolved live-query Collection (or null for a disabled query) with the shared lifecycle every framework adapter needs: start sync on first subscribe, subscribe to changes and status transitions, expose a stable snapshot for wholesale consumers, and deliver the raw change set for granular consumers.
Input resolution (query fn / config / collection / disabled) stays in the adapter — it is framework-reactive. The observer owns everything after the input is resolved to a concrete collection.
Unstable contract for TanStack DB's official framework adapters — not a public extension point yet; may change in any release.
T extends object
TKey extends string | number
dispose: () => void;Defined in: packages/db/src/live-query-observer.ts:86
Idempotent teardown.
void
getSnapshot: () => LiveQuerySnapshot<T, TKey>;Defined in: packages/db/src/live-query-observer.ts:75
Stable per-revision snapshot for wholesale materialization.
LiveQuerySnapshot<T, TKey>
preload: () => Promise<void>;Defined in: packages/db/src/live-query-observer.ts:84
Resolve once the collection has loaded its first data.
Promise<void>
subscribe: (listener) => () => void;Defined in: packages/db/src/live-query-observer.ts:82
Subscribe to changes. The listener receives the change set (or undefined for the synthetic notify a ready collection emits on attach). Granular adapters apply the changes; wholesale adapters can ignore them and re-read getSnapshot(). Returns an unsubscribe function.
LiveQueryObserverListener<T, TKey>
(): void;void