From 3611fcab1632b51221017b6fec217fb84b3fcac2 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Mon, 11 Jan 2021 23:07:53 +0000 Subject: [PATCH] channel-js: ensure lastEventId is an integer, and correctly set lastAckedEvent --- pkg/arvo/app/landscape/js/channel.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/app/landscape/js/channel.js b/pkg/arvo/app/landscape/js/channel.js index a85fda9ba9..82064b595b 100644 --- a/pkg/arvo/app/landscape/js/channel.js +++ b/pkg/arvo/app/landscape/js/channel.js @@ -63,7 +63,7 @@ class Channel { } resetDebounceTimer() { - if(this.debounceTimer) { + if (this.debounceTimer) { clearTimeout(this.debounceTimer); this.debounceTimer = null; } @@ -203,7 +203,7 @@ class Channel { // let payload = [ ...this.outstandingJSON, - {action: "ack", "event-id": parseInt(this.lastEventId)} + {action: "ack", "event-id": this.lastEventId} ]; if (j) { payload.push(j) @@ -211,7 +211,7 @@ class Channel { let x = JSON.stringify(payload); req.send(x); - this.lastEventId = this.lastAcknowledgedEventId; + this.lastAcknowledgedEventId = this.lastEventId; } this.outstandingJSON = []; @@ -227,7 +227,7 @@ class Channel { this.eventSource = new EventSource(this.channelURL(), {withCredentials:true}); this.eventSource.onmessage = e => { - this.lastEventId = e.lastEventId; + this.lastEventId = parseInt(e.lastEventId, 10); let obj = JSON.parse(e.data); let pokeFuncs = this.outstandingPokes.get(obj.id);