API reference › @evolu/common › local‑first/Schema › MutationOptions
Defined in: packages/common/src/local-first/Schema.ts:202
Properties
onComplete?
readonly optional onComplete?: () => void;
Defined in: packages/common/src/local-first/Schema.ts:208
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.
ownerId?
readonly optional ownerId?: string & Brand<"Id"> & Brand<"OwnerId">;
Defined in: packages/common/src/local-first/Schema.ts:241
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 });