[FIX] mail: guard all messaging root.el

`this.root.el` can become undefined, so it should always be guarded.

closes odoo/odoo#88053

X-original-commit: 2e634bb431642fbe21b61d61354c85282c365d40
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2022-04-06 11:14:58 +02:00
parent dec47d8459
commit bf572ec3e6
6 changed files with 22 additions and 0 deletions
@@ -50,6 +50,9 @@ export class AttachmentViewer extends Component {
}
_mounted() {
if (!this.root.el) {
return;
}
this.root.el.focus();
this._handleImageLoad();
this._hideUnwantedPdfJsButtons();
@@ -22,6 +22,9 @@ export class AutocompleteInput extends Component {
}
_mounted() {
if (!this.root.el) {
return;
}
if (this.props.isFocusOnMount) {
this.root.el.focus();
}
@@ -48,6 +51,9 @@ export class AutocompleteInput extends Component {
}
_willUnmount() {
if (!this.root.el) {
return;
}
$(this.root.el).autocomplete('destroy');
}
@@ -84,6 +84,9 @@ export class ChatWindow extends Component {
// chat window is being deleted
return;
}
if (!this.root.el) {
return;
}
if (this.chatWindow.isDoFocus) {
this.chatWindow.update({ isDoFocus: false });
if (this._inputRef.el) {
@@ -28,11 +28,17 @@ export class ChatWindowHiddenMenu extends Component {
}
_mounted() {
if (!this.root.el) {
return;
}
this._apply();
document.addEventListener('click', this._onClickCaptureGlobal, true);
}
_patched() {
if (!this.root.el) {
return;
}
this._apply();
}
@@ -72,6 +72,7 @@ export class ComposerSuggestion extends Component {
*/
_update() {
if (
this.root.el &&
this.composerView &&
this.composerView.hasToScrollToActiveSuggestion &&
this.props.isActive
@@ -114,6 +114,9 @@ export class ComposerTextInput extends Component {
if (!this.composerView) {
return;
}
if (!this.root.el) {
return;
}
if (this.composerView.doFocus) {
this.composerView.update({ doFocus: false });
if (this.messaging.device.isMobile) {