[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
This commit is contained in:
Aaron Bohy
2022-06-30 09:29:48 +02:00
parent 7e86933d94
commit 0196c052f1
@@ -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();