Skip to content

Commit

Permalink
Logic for JSON patching. JIRA: GNS-42
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-seymour committed Jul 19, 2023
1 parent d8a1a04 commit dc94fdc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions frontend/src/Websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,21 @@ const setupWebsocket = (onStateUpdate: (state: State) => void) => {

switch (msg.type) {
case "Patch": {
if (todo !== undefined) {
let {newDocument: newState} = applyPatch(todo, msg.ops, false, fals)
if (state !== undefined) {
let {newDocument: newState} = applyPatch(state, msg.ops, false, false);

onStateUpdate(newState);
state = newState;
}
break;
}

case "Full" : {

onStateUpdate(msg.state);
state = msg.state;
break;
}
}
}
};
};

0 comments on commit dc94fdc

Please sign in to comment.