diff --git a/web/SyncedGraph.ts b/web/SyncedGraph.ts --- a/web/SyncedGraph.ts +++ b/web/SyncedGraph.ts @@ -151,22 +151,19 @@ export class SyncedGraph { } applyAndSendPatch(patch: Patch) { - console.time("applyAndSendPatch"); if (!this.client) { - log("not connected-- dropping patch"); + throw new Error("no client yet"); + } + if (patch.isEmpty()) { return; } - if (!patch.isEmpty()) { - this._applyPatch(patch); - // // chaos delay - // setTimeout(()=>{ - if (this.client) { - log("sending patch:\n", patch.dump()); - this.client.sendPatch(patch); - } - // },300*Math.random()) - } - console.timeEnd("applyAndSendPatch"); + this._applyPatch(patch); + // // chaos delay + // setTimeout(()=>{ + log("sending patch:\n", patch.dump()); + this.client.sendPatch(patch); + + // },300*Math.random()) } _applyPatch(patch: Patch) {