API reference › @evolu/svelte › QueryState

Defined in: index.svelte.ts:182

What queryState returns, whose properties update when the query or its rows change.

Properties

loaded

readonly loaded: Promise<QueryRows<R>>;

Defined in: index.svelte.ts:206

The first load of the current query, which resolves with its rows or rejects with the UnknownError of SQLite failing it. When the query changes, also before this load settles, it's the new query's first load. A later refresh, also one SQLite fails, leaves it as it is, and rows keeps the rows. A failure the app awaits reaches only the app, and one that nothing awaits is reported as an unhandled rejection.

Without a query, it has resolved with no rows. It's pending until the effect starts the load, so also during server rendering. It stays pending for an instance whose database's deletion, or its AppOwner's removal, disposed it, as React's useQuery stays suspended until the app replaces the instance, and while a refused database answers no load, until the instance's disposal resolves it with no rows. Observe EvoluErrorDep.evoluError to show the refusal.


rows

readonly rows: QueryRows<R>;

Defined in: index.svelte.ts:188

The rows of the current query: empty until the query loads and while there is no query. When SQLite fails the query, they keep the rows the query last loaded, if any.