Defined in: packages/db/src/live-query-observer.ts:72
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
dehydrate: () => DehydratedLiveQueryResult<T, TKey>;Defined in: packages/db/src/live-query-observer.ts:92
Capture the ordered query result without serializing its source collections.
DehydratedLiveQueryResult<T, TKey>
dispose: () => void;Defined in: packages/db/src/live-query-observer.ts:94
Idempotent teardown.
void
getError: () => unknown;Defined in: packages/db/src/live-query-observer.ts:90
The transport or preload error for this query, if it has not produced data.
unknown
getServerSnapshot: () => LiveQuerySnapshot<T, TKey>;Defined in: packages/db/src/live-query-observer.ts:79
Stable server snapshot used by useSyncExternalStore-style adapters.
LiveQuerySnapshot<T, TKey>
getSnapshot: () => LiveQuerySnapshot<T, TKey>;Defined in: packages/db/src/live-query-observer.ts:77
Stable per-revision snapshot for wholesale materialization.
LiveQuerySnapshot<T, TKey>
preload: () => Promise<void>;Defined in: packages/db/src/live-query-observer.ts:88
Resolve once the collection has loaded its first data.
Promise<void>
subscribe: (listener) => () => void;Defined in: packages/db/src/live-query-observer.ts:86
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