@tanstack/react-db
Version:
React integration for @tanstack/db
21 lines (20 loc) • 1.14 kB
text/typescript
import { DbClient } from '@tanstack/db';
export { resumeDeferredLiveQueryCollections as resumeSyncStarts } from '@tanstack/db';
export declare function getSourceObjectToken(source: object): number;
export declare function getPreparedSources(preparedValue: unknown, client?: DbClient, hookName?: string): 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;