Skip to content

Commit 7076cfe

Browse files
committed
fix(json-crdt): 🐛 use this.model after it is defined
1 parent 919196b commit 7076cfe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import type {Operation} from '../../json-patch';
44
import type {Patch} from '../../json-crdt-patch/Patch';
55

66
export class JsonPatch {
7-
protected draft = new JsonPatchDraft(this.model);
7+
protected draft: JsonPatchDraft;
88

9-
constructor(public readonly model: Model) {}
9+
constructor(public readonly model: Model) {
10+
this.draft = new JsonPatchDraft(this.model);
11+
}
1012

1113
public apply(ops: Operation[]): this {
1214
this.draft.applyOps(ops);

0 commit comments

Comments
 (0)