Remote / foldkit-remote/why

explain

function · packages/remote/src/why.ts:140

function explain<Domain extends AnyDomain, Name extends string, Input>(
  domain: Domain,
  model: ModelOfDomain<Domain>,
  projection: QueryProjection<ModelOfDomain<Domain>, any, Name, Input>,
  options?: ExplainOptions<ModelOfDomain<Domain>>,
): QueryExplanation

What a query read is and what it currently is, as one serializable value — data-query-DESIGN §29.1: the domain, the definition and its input, the connection identity, the window, the Selection, the body as readable text with what it depends on, and what the read answers from this Model.

Pure, so a DevTools panel showing it shows something the Model can be replayed to.

Given surfaces — the same active record subscriptions takes — it also reports which of them read this connection, and why each is active where that is a readable fact (Surface.when) rather than a callback (Surface.at). A Projection cannot carry this itself: several Surfaces may read one connection, so it is not a property of the read.