From a4c737eb1d45610f6ab70268d5134dc5ed00ba8d Mon Sep 17 00:00:00 2001 From: Xavier Dubuc Date: Mon, 2 Nov 2020 14:13:22 +0000 Subject: [FIX] mail: prevent load messages if already loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit task-2373952 closes odoo/odoo#61172 Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/models/thread_cache/thread_cache.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'addons/mail/static/src/models/thread_cache/thread_cache.js') diff --git a/addons/mail/static/src/models/thread_cache/thread_cache.js b/addons/mail/static/src/models/thread_cache/thread_cache.js index c474c565219..c684861e2be 100644 --- a/addons/mail/static/src/models/thread_cache/thread_cache.js +++ b/addons/mail/static/src/models/thread_cache/thread_cache.js @@ -203,13 +203,17 @@ function factory(dependencies) { if (!wasCacheRefreshRequested && this.threadViews.length === 0) { // don't load message that won't be used return false; - } - if (!wasCacheRefreshRequested && (this.isLoaded || this.isLoading)) { + } + if (this.isLoading) { + // avoid duplicate RPC + return false; + } + if (!wasCacheRefreshRequested && this.isLoaded) { // avoid duplicate RPC return false; } const isMainCache = this.thread.mainCache === this; - if (isMainCache && (this.isLoaded || this.isLoading)) { + if (isMainCache && this.isLoaded) { // Ignore request on the main cache if it is already loaded or // loading. Indeed the main cache is automatically sync with // server updates already, so there is never a need to refresh -- cgit v1.2.3