UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

25 lines (24 loc) • 1.19 kB
import { CollectionSubscription } from '../../collection/subscription.js'; import { LazyCollectionCallbacks, LazyDemandPlan } from '../compiler/joins.js'; export type DemandUpdate = { changed: boolean; empty: boolean; ready: Promise<Array<unknown>> | true; }; /** * Keeps lazy subset requests aligned with the current relation of demanded * keys. Growth loads only new keys. Churn replaces fragmented coverage after * the replacement applies, so prior coverage remains live in the meantime. */ export declare class SubsetDemandController { private readonly states; private readonly warnedPlans; private valueIdentity; setDemand(subscription: CollectionSubscription, plan: LazyDemandPlan, keys: Set<unknown>): DemandUpdate; clear(): void; hasPendingDemand(planId: string): boolean; private finishReplacement; private warnUnoptimized; } /** An ordered filter waits only for demand on its joined source. */ export declare function hasPendingJoinedWork(joinedSourceId: string, lazySourcesCallbacks: Record<string, LazyCollectionCallbacks>, subscriptions: Record<string, CollectionSubscription>, isPendingPlan: (planId: string) => boolean): boolean;