Send incremental CRDT changes from package runtimes

This commit is contained in:
Timothy J. Aveni
2026-09-03 09:41:08 -07:00
parent 8fc1060b65
commit 013d4cf3c8
7 changed files with 21 additions and 10 deletions
+8 -1
View File
@@ -10,6 +10,7 @@ import {
} from "@connectrpc/connect";
import * as Automerge from "@automerge/automerge";
import {
createAutomergeFieldChanges,
createAutomergeFieldValue,
encodeAutomergeFieldWrite,
loadAutomergeFieldDoc,
@@ -836,7 +837,13 @@ export const createCrdtField = <T>(
const next = Automerge.change(current, (doc) => {
fn(doc as { value: T });
}) as CaminoAutomergeDoc<T>;
await field.set(next);
await camino.setField({
objectId,
fieldName,
value: jsToProtoValue(
createAutomergeFieldChanges(current, next, fieldType),
),
});
return next;
},
async replaceFromJson(value) {