Skip to main content
browser.Watch A query watch shared by browser, Node, React and resource adapters.

Type parameters

Methods

onUpdate

▸ onUpdate(callback): () => void Initiate a watch on the output of a query. This will subscribe to this query and call the callback whenever the query result changes. Important: If the client is already subscribed to this query with the same arguments this callback will not be invoked until the query result is updated. To get the current, local result call localQueryResult.

Parameters

Returns

fn
  • A function that disposes of the subscription.
▸ (): void
Returns
void

localQueryResult

▸ localQueryResult(): T | undefined Get the current result of a query. This will only return a result if we’re already subscribed to the query and have received a result from the server or the query value has been set optimistically. Throws An error if the query encountered an error on the server.

Returns

T | undefined The result of the query or undefined if it isn’t known.

journal

▸ journal(): QueryJournal | undefined Get the current QueryJournal for this query. If we have not yet received a result for this query, this will be undefined.

Returns

QueryJournal | undefined