Skip to content

Commit b377d7c

Browse files
committed
feat(json-crdt): 🎸 apply JSON Patch operations in a tracsaction
1 parent dcbbc54 commit b377d7c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/json-crdt/json-patch/JsonPatch.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export class JsonPatch<N extends JsonNode = JsonNode<any>> {
1515

1616
public apply(ops: Operation[]): this {
1717
const length = ops.length;
18-
for (let i = 0; i < length; i++) this.applyOp(ops[i]);
18+
this.model.api.transaction(() => {
19+
for (let i = 0; i < length; i++) this.applyOp(ops[i]);
20+
});
1921
return this;
2022
}
2123

0 commit comments

Comments
 (0)