From ef58120819be0c1709756fe01d707d1131c8b544 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 28 Apr 2017 14:09:59 +0200 Subject: [PATCH] Prevent multiple concurrent clicks to get the history --- www/common/common-history.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/www/common/common-history.js b/www/common/common-history.js index 58fd54900..2cd5b7707 100644 --- a/www/common/common-history.js +++ b/www/common/common-history.js @@ -75,6 +75,8 @@ define([ var create = History.create = function (common, config) { if (!config.$toolbar) { return void console.error("config.$toolbar is undefined");} + if (History.loading) { return void console.error("History is already being loaded..."); } + History.loading = true; var $toolbar = config.$toolbar; var noFunc = function () {}; var render = config.onRender || noFunc; @@ -210,6 +212,7 @@ define([ // Load all the history messages into a new chainpad object loadHistory(common, function (err, newRt) { + History.loading = false; if (err) { throw new Error(err); } realtime = newRt; update();