UNPKG

@tanstack/react-db

Version:

React integration for @tanstack/db

27 lines (26 loc) • 1.27 kB
import { DbClient } from '@tanstack/db'; export declare function getSourceObjectToken(source: object): number; export declare function getPreparedSources(preparedValue: unknown): Array<{ id: string; }>; /** The source object each Collection ID named while one hook is mounted. */ export type SourceIdBindings = { unscoped: Map<string, number>; byClient: WeakMap<DbClient, Map<string, number>>; }; export declare function createSourceIdBindings(): SourceIdBindings; /** * Derived query identity names each source by its Collection ID. While a hook * is mounted, an ID must keep naming one source object in each client scope, * or the hook could reuse a live query that reads the old source. Claims the * prepared value's sources, or calls `release` and throws on a collision so a * rejected render keeps no sync-start deferral. */ export declare function claimSourceIds(bindings: SourceIdBindings, preparedValue: unknown, client: DbClient | undefined, hookName: string, release: () => void): void; /** * Resumes every deferred sync start, then rethrows the first startup error, so * one failing source cannot keep a later shared source deferred. */ export declare function resumeSyncStarts(collections: Set<{ _resumeSyncStart: () => void; }>): void;