API reference › @evolu/vue

Interfaces

InterfaceDescription
UseQueriesOptionsOptions of useQueries and useDeviceQueries.
UseQueryOptionsOptions of useQuery and useDeviceQuery.
VueBindingThe composables createEvoluBinding returns, typed with the app's schema S and its device schema D.

Type Aliases

Type AliasDescription
QueriesToQueryRowsRef-

Variables

VariableDescription
EvoluAppContextThe injection key for providing an EvoluApp.
EvoluAppProviderProvides an EvoluApp to its slots. The default slot gets the instance of the AppOwner this tab has open, so useEvolu and the query composables read that AppOwner's data, and useEvolu().appOwner is that AppOwner. The slot remounts when the tab opens another AppOwner, or the AppOwner again after a removal and restore or its database's deletion. While the tab has no AppOwner open, such as on a device without one or after a removal of the open one, it renders the withoutAppOwner slot, such as a choice to open one of useAppOwners, create one, or restore one. While the AppOwner's instance opens, it renders the opening slot, such as a spinner, and nothing without it. Each slot can call useEvoluApp.
EvoluContextThe injection key for providing Evolu.
evoluInstanceMapStores the Evolu instance for a Vue component. This is most useful at the root component where provide/inject doesn't work.
EvoluProvider-

Functions

FunctionDescription
createEvoluBindingReturns useEvolu, useEvoluApp, useDeviceEvolu, and the query composables typed with the app's schema and its device schema, for an app that EvoluAppProvider provides. useQuery and useQueries then take only queries of the app's tables, and useDeviceQuery and useDeviceQueries only queries of its device tables. It only types them. Its useEvolu and the composables of the app's tables also read an instance of createEvolu that provideEvolu or EvoluProvider provides.
createUseEvoluCreates a helper function returning a type-aware instance of Evolu, without disposal, because the component doesn't own it. It's for an app that creates its instance with createEvolu; an app that EvoluAppProvider provides uses createEvoluBinding.
provideEvoluProvide the Evolu instance to components via Vue's provide/inject system. It takes an AppOwnerEvolu, an Evolu instance without disposal, because the components never dispose it.
useAppOwnersVue composable returning EvoluApp.appOwners, the AppOwners the app can open on this device, in a ref that follows them until the current effect scope, such as the component, is disposed. During server rendering, it reads them once.
useDeviceEvoluVue composable returning EvoluApp.device, the instance of the device database with the app's own device tables. Applications should prefer createEvoluBinding for proper typing.
useDeviceQueriesThe same as useDeviceQuery, but for many queries. createEvoluBinding returns it typed with the app's device schema.
useDeviceQueryThe same as useQuery, for a query of the app's device tables, read from useDeviceEvolu, so waitForRows takes its rows too. createEvoluBinding returns it typed with the app's device schema.
useEvoluVue composable returning a generic instance of Evolu, without disposal, because the component doesn't own it.
useEvoluAppReturns the EvoluApp from EvoluAppProvider. Applications should prefer createEvoluBinding for proper typing.
useOwnerVue composable for Evolu useOwner method.
useOwnerSyncStatusVue composable returning the OwnerSyncStatus of an owner in the database of the provided Evolu instance, read from syncState, the SyncStateDep.syncState store of the deps the instance was created with. Without an owner, it is the status of Evolu.appOwner. Otherwise pass the owner useOwner takes; a null owner, for a component that waits for one, gives NoRelays. Like the other composables, it reads its arguments once, so a component that shows another owner is keyed by that owner. Before the first snapshot, during server rendering, and until a hydrating component mounts, the status is NoRelays. Server rendering starts when the server renderer does, so a call on the server before that, such as from a store that a router guard uses first, follows the store as on the client.
useQueriesThe same as useQuery, but for many queries. waitForRows takes the rows it returns, such as await waitForRows(...rows).
useQueryLoad and subscribe to the query, returning a ref that stays in sync with Evolu changes.
useStoreVue composable returning the value of an Evolu ReadonlyStore, such as evoluError or syncState of the deps, in a ref that follows the store until the current effect scope, such as the component, is disposed. It's what React's useSyncExternalStore does for a store. A store replaces its value rather than mutating it, so the ref changes only when the value does. During server rendering, it reads the store once.
waitForRowsWaits for the first load of each query whose rows useQuery, useQueries, useDeviceQuery, or useDeviceQueries returned, so an async setup under <Suspense> renders once they loaded, and <Suspense> shows its fallback meanwhile. Call the composables before awaiting it, because a composable can't run after an await in setup().