API reference / @evolu/common / local-first / MutationOptions
Interface: MutationOptions
Defined in: packages/common/src/local-first/Schema.ts:276
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
onComplete? | readonly | () => void | Called after the mutation is completed and the local state is updated. Useful for triggering side effects (e.g., notifications, UI updates) after insert, update, or upsert. | packages/common/src/local-first/Schema.ts:282 |
onlyValidate? | readonly | boolean | Only validate, don't mutate. For example, onChange handler can call insert/update/upsert with onlyValidate: true. | packages/common/src/local-first/Schema.ts:325 |
ownerId? | readonly | string & Brand<"Id"> & Brand<"OwnerId"> | Experimental Specifies the owner ID for this mutation. If omitted, the default AppOwner is used. The owner must be used with evolu.useOwner() to enable sync. Mutations with unused owners are stored locally but not synced until the owner is used. ### Example // Partition your own data by project (derived from your AppOwner) const projectOwner = deriveShardOwner(appOwner, [ "project", projectId, ]); evolu.insert( "task", { title: "Task 1" }, { ownerId: projectOwner.id }, ); // Collaborative data (independent owner shared with others) const sharedOwner = createSharedOwner(sharedSecret); evolu.insert( "comment", { text: "Hello" }, { ownerId: sharedOwner.id }, ); | packages/common/src/local-first/Schema.ts:317 |