File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed
packages/app/src/app/overmind/effects/live Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ export class CodeSandboxOTClient extends OTClient {
4141 ) {
4242 super ( revision ) ;
4343 this . moduleShortid = moduleShortid ;
44+ this . lastAcknowledgedRevision = revision - 1 ;
4445 this . onSendOperation = onSendOperation ;
4546 this . onApplyOperation = onApplyOperation ;
4647 }
@@ -65,13 +66,7 @@ export class CodeSandboxOTClient extends OTClient {
6566 } ) } `,
6667 } ) ;
6768
68- // We make sure to not acknowledge the same revision twice
69- if ( this . lastAcknowledgedRevision < revision ) {
70- this . lastAcknowledgedRevision = revision ;
71- this . serverAck ( ) ;
72- } else {
73- this . resetAwaitSynchronized ( ) ;
74- }
69+ this . safeServerAck ( revision ) ;
7570 } )
7671 . catch ( error => {
7772 // If an operation errors on the server we will reject
@@ -98,16 +93,14 @@ export class CodeSandboxOTClient extends OTClient {
9893 }
9994 }
10095
101- serverAck ( ) {
102- try {
96+ safeServerAck ( revision : number ) {
97+ // We make sure to not acknowledge the same revision twice
98+ if ( this . lastAcknowledgedRevision < revision ) {
99+ this . lastAcknowledgedRevision = revision ;
103100 super . serverAck ( ) ;
104-
105- this . resetAwaitSynchronized ( ) ;
106- } catch ( e ) {
107- // Undo the revision increment again
108- super . revision -- ;
109- throw e ;
110101 }
102+
103+ this . resetAwaitSynchronized ( ) ;
111104 }
112105
113106 applyClient ( operation : TextOperation ) {
You can’t perform that action at this time.
0 commit comments