API reference › @evolu/common › local‑first/Evolu › UseOwnerOptions

Defined in: packages/common/src/local-first/Evolu.ts:1319

Options of Evolu.useOwner.

Properties

deleteWhenUnused?

readonly deleteWhenUnused?: boolean;

Defined in: packages/common/src/local-first/Evolu.ts:1345

With true, this database keeps syncing the owner for 10 seconds after its last registration in any instance of the database, in any tab, ends, and then deletes the owner's rows if every relay has all of the owner's changes by then. It deletes them as Evolu.deleteOwner does, local-only rows included, and refreshes the queries of every instance, but calls no EvoluConfig.onOwnerDeleted, because nothing uses the owner then. A new registration within those 10 seconds keeps the rows. The delay covers a page that unmounts and mounts again, a change of relays, and a quick return to the page, any of which would otherwise delete the rows and download them again.

The rows stay if the app closes within those 10 seconds, if a relay still lacks changes when they end, also a relay the owner stopped syncing with while another registration remained or after one replaced it within those 10 seconds, or if any registration while the owner was in use didn't set this option to true or was readonly, which sends nothing, so Evolu can't tell whether relays have the owner's rows. They then stay until the owner is used with this option and released again. Throws for the instance's own AppOwner and any owner with its ID, which names the database; Evolu.deleteDatabase deletes the whole database instead.


transports?

readonly transports?: readonly [OwnerWebSocketTransport, OwnerWebSocketTransport];

Defined in: packages/common/src/local-first/Evolu.ts:1321

The transports that sync the owner, instead of the default ones.