From 4d618b714aa95e908868d4b4d94c920c42e4f649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Tue, 21 Apr 2020 18:28:35 +0200 Subject: [PATCH] [FIX] mail, web: correctly handle mounting operation cancelled error --- .../widget/form_renderer/form_renderer.js | 20 +++++++++++++++---- addons/web/static/lib/owl/owl.js | 3 +-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/addons/mail/static/src/messaging/widget/form_renderer/form_renderer.js b/addons/mail/static/src/messaging/widget/form_renderer/form_renderer.js index 0bc8a7a1ab6f4..e1f6147ed8e4f 100644 --- a/addons/mail/static/src/messaging/widget/form_renderer/form_renderer.js +++ b/addons/mail/static/src/messaging/widget/form_renderer/form_renderer.js @@ -111,7 +111,13 @@ FormRenderer.include({ * @private */ async _mountChatterContainerComponent() { - await this._chatterContainerComponent.mount(this._chatterContainerTarget); + try { + await this._chatterContainerComponent.mount(this._chatterContainerTarget); + } catch (error) { + if (error.message !== "Mounting operation cancelled") { + throw error; + } + } }, /** * @override @@ -141,7 +147,7 @@ FormRenderer.include({ if (!this._chatterContainerComponent) { this._makeChatterContainerComponent(); } else { - this._updateChatterContainerComponent(); + await this._updateChatterContainerComponent(); } await this._mountChatterContainerComponent(); } @@ -149,9 +155,15 @@ FormRenderer.include({ /** * @private */ - _updateChatterContainerComponent() { + async _updateChatterContainerComponent() { const props = this._makeChatterContainerProps(); - this._chatterContainerComponent.update(props); + try { + await this._chatterContainerComponent.update(props); + } catch (error) { + if (error.message !== "Mounting operation cancelled") { + throw error; + } + } }, //-------------------------------------------------------------------------- diff --git a/addons/web/static/lib/owl/owl.js b/addons/web/static/lib/owl/owl.js index 22319dcae192d..273315ba9e184 100644 --- a/addons/web/static/lib/owl/owl.js +++ b/addons/web/static/lib/owl/owl.js @@ -3174,8 +3174,7 @@ if (index >= 0) { const [task] = this.tasks.splice(index, 1); fiber.cancel(); - // Do not leak Mounting operation cancelled as a crash: https://github.com/odoo/owl/issues/676 - fiber.error = reason; + fiber.error = new Error(reason); task.callback(); } }