From 14b1bbb248b39e0ddef4f3eb1f0f130f650ebdd4 Mon Sep 17 00:00:00 2001 From: Paul Morelle Date: Thu, 19 Nov 2020 14:15:13 +0000 Subject: [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#62076 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(-) (limited to 'addons/mail/static/src/models/thread_cache') 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; -- cgit v1.2.3