Skip to content

Commit b353ebe

Browse files
committed
Handle when duplicate serverAck arrives
1 parent 144dc14 commit b353ebe

File tree

1 file changed

+8
-1
lines changed
  • packages/app/src/app/overmind/effects/live

1 file changed

+8
-1
lines changed

packages/app/src/app/overmind/effects/live/clients.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function operationToElixir(ot) {
2424

2525
class CodeSandboxOTClient extends Client {
2626
moduleShortid: string;
27+
revision: number;
2728
onSendOperation: (revision: string, operation: any) => Promise<unknown>;
2829
onApplyOperation: (operation: any) => void;
2930

@@ -52,7 +53,13 @@ class CodeSandboxOTClient extends Client {
5253
}
5354

5455
serverAck() {
55-
super.serverAck();
56+
try {
57+
super.serverAck();
58+
} catch (e) {
59+
// Undo the revision increment again
60+
this.revision--;
61+
throw e;
62+
}
5663
}
5764

5865
applyClient(operation: any) {

0 commit comments

Comments
 (0)