From e56055f12dd4ecb356605137e7494cc6440abeab Mon Sep 17 00:00:00 2001 From: ralf Date: Wed, 25 Jan 2023 14:55:06 +0100 Subject: [PATCH] defer calls to mail_refreshFolderStatus for 2s, to accumulate updates of multiple rows e.g. deleting multiple emails --- mail/js/app.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index 6daa5d0066..638de3ea08 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -228,11 +228,19 @@ app.classes.mail = AppJS.extend( if (nm != null && (typeof jQuery._data(nm).events == 'undefined' || typeof jQuery._data(nm).events.refresh == 'undefined')) { var self = this; - jQuery(nm).on('refresh', function (_event, _widget, _row_id, _type) + jQuery(nm).on('refresh', (_event, _widget, _row_id, _type) => { if (!self.push_active[_widget.settings.foldertree.split("::")[0]]) { - self.mail_refreshFolderStatus.call(self, undefined, undefined, false); + // defer calls to mail_refreshFolderStatus for 2s, to accumulate updates of multiple rows e.g. deleting multiple emails + if (typeof self.refresh_timeout === 'undefined') + { + self.refresh_timeout = window.setTimeout(() => + { + delete self.refresh_timeout; + self.mail_refreshFolderStatus.call(self, undefined, undefined, false); + }, 2000); + } } }); }