From e9033d8b0aa2cd151e32584ff2fb82ed64f9448b Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 11 Dec 2020 17:06:37 +0530 Subject: [PATCH] rule out double-callbacks when clearing cache --- www/common/outer/local-store.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/www/common/outer/local-store.js b/www/common/outer/local-store.js index c6d937e94..95a3bd88b 100644 --- a/www/common/outer/local-store.js +++ b/www/common/outer/local-store.js @@ -4,7 +4,8 @@ define([ '/common/outer/cache-store.js', '/bower_components/localforage/dist/localforage.min.js', '/customize/application_config.js', -], function (Constants, Hash, Cache, localForage, AppConfig) { + '/common/common-util.js', +], function (Constants, Hash, Cache, localForage, AppConfig, Util) { var LocalStore = {}; LocalStore.setThumbnail = function (key, value, cb) { @@ -120,10 +121,10 @@ define([ return void AppConfig.customizeLogout(cb); } - cb = cb || function () {}; + cb = Util.once(cb || function () {}); try { - Cache.clear(cb); // XXX might call back twice in extreme circumstances? + Cache.clear(cb); } catch (e) { console.error(e); cb();