[FIX] mail: avoid a stack overflow during loading

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) <seb@odoo.com>
This commit is contained in:
Paul Morelle
2020-11-20 13:36:00 +00:00
parent a24cd324c0
commit 05b151d4e4
@@ -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;