Remote / foldkit-remote/live

liveQuery

function · packages/remote/src/live.ts:84

function liveQuery<
  Domain extends AnyDomain,
  Q extends QueryDescriptor<any, any, any>,
  Value,
  Entity extends string,
>(
  domain: Domain,
  query: Q & Registered<Q['name'], QueryNames<Domain>, 'Query'>,
  input: QueryInput<Q>,
  options: QueryOptions<Value, Entity, QueryEntity<Q>> & {
    readonly first: number
  },
): QueryProjection<ModelOfDomain<Domain>, Value, Q['name'], QueryInput<Q>>
function liveQuery<AppModel>(
  domain: {
    readonly [Capability]: Capabilities
  },
  query: QueryDescriptor<any, any, any>,
  input: unknown,
  options: QueryOptions<any, string, string> & {
    readonly first: number
  },
): QueryProjection<AppModel, any, string, unknown>

Data.query, and the list is watched live while a Surface reads it: rows that join, change or leave it are streamed (by a live source that watches queries, such as foldkit-remote-drizzle's pollLive). Needs first: a list watched live is read again every tick.