From 7bc0c7ce95787291147097ef21886e18921657c8 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 17 Jul 2019 10:49:26 +0200 Subject: [PATCH] Fix duplicate notifications n reconnect --- www/common/outer/mailbox.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/www/common/outer/mailbox.js b/www/common/outer/mailbox.js index 24d14345f..081f64cc3 100644 --- a/www/common/outer/mailbox.js +++ b/www/common/outer/mailbox.js @@ -245,8 +245,11 @@ proxy.mailboxes = { }); box.queue = []; }; + var lastReceivedHash; // Don't send a duplicate of the last known hash on reconnect box.onMessage = cfg.onMessage = function (msg, user, vKey, isCp, hash, author) { if (hash === m.lastKnownHash) { return; } + if (hash === lastReceivedHash) { return; } + lastReceivedHash = hash; try { msg = JSON.parse(msg); } catch (e) { @@ -364,6 +367,7 @@ proxy.mailboxes = { txid: txid, complete: true }, [req.cId]); + delete ctx.req[txid]; } }); };