From 05b151d4e4ec9c2c4ed9f6494e55a3f8b8072b4c Mon Sep 17 00:00:00 2001 From: Paul Morelle Date: Thu, 19 Nov 2020 14:15:13 +0000 Subject: [PATCH] [FIX] mail: avoid a stack overflow during loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the amount of mail messages is big enough (about 1500?), the recursion goes deeper and deeper, until the Javascript limit raises an infinite recursion error. This commit fixes the issue by avoiding to run an inner _flushUpdateCycle with the update if the change is not needed, so the second time that it is reached it does not start a new update, which would have run another flush update cycle. closes odoo/odoo#62096 X-original-commit: 14b1bbb248b39e0ddef4f3eb1f0f130f650ebdd4 Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/models/thread_cache/thread_cache.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 5ca4443df5f..8383936a3f1 100644 --- a/addons/mail/static/src/models/thread_cache/thread_cache.js +++ b/addons/mail/static/src/models/thread_cache/thread_cache.js @@ -195,7 +195,9 @@ function factory(dependencies) { } const wasCacheRefreshRequested = this.isCacheRefreshRequested; // mark hint as processed - this.update({ isCacheRefreshRequested: false }); + if (this.isCacheRefreshRequested) { + this.update({ isCacheRefreshRequested: false }); + } if (this.thread.isTemporary) { // temporary threads don't exist on the server return false;