From 0196c052f17742b4a3fcae6a1fc41d56a9e9e426 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Tue, 28 Jun 2022 06:22:57 +0000 Subject: [PATCH] [FIX] mail: check existence of record in FollowerListMenu This commit fixes a race condition that makes several tours crash. The reason is that the underlying record is removed from the model which produces a re-rendering. At the end of that re-rendering, a component is unmounted. At that point, we remove an handler relying on the existence of the record. As a consequence, there was a short time window during which the handler would crash if it was called. Part-of: odoo/odoo#92475 --- .../src/components/follower_list_menu/follower_list_menu.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/mail/static/src/components/follower_list_menu/follower_list_menu.js b/addons/mail/static/src/components/follower_list_menu/follower_list_menu.js index b68c9a44c8f..e19ae239544 100644 --- a/addons/mail/static/src/components/follower_list_menu/follower_list_menu.js +++ b/addons/mail/static/src/components/follower_list_menu/follower_list_menu.js @@ -57,6 +57,9 @@ export class FollowerListMenu extends Component { * @param {MouseEvent} ev */ _onClickCaptureGlobal(ev) { + if (!this.followerListMenuView.exists()) { + return; + } // since dropdown is conditionally shown based on state, dropdownRef can be null if (this._dropdownRef.el && !this._dropdownRef.el.contains(ev.target)) { this.followerListMenuView.hide();