[IMP] mail: prevent useless render of message view

Avoid observing the last message view just for checking the state of self.

task-2800990

closes odoo/odoo#87003

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Sébastien Theys
2022-03-23 00:29:26 +01:00
parent 1043c6c65c
commit 57ac4a4dca
2 changed files with 11 additions and 1 deletions
@@ -40,7 +40,7 @@ registerModel({
this.highlight();
this.update({ doHighlight: clear() });
}
if (this.threadView && this.threadView.lastMessageView === this && this.component && this.component.isPartiallyVisible()) {
if (this.threadViewOwnerAsLastMessageView && this.component && this.component.isPartiallyVisible()) {
this.threadView.handleVisibleMessage(this.message);
}
},
@@ -268,5 +268,13 @@ registerModel({
inverse: 'messageViews',
readonly: true,
}),
/**
* States whether this message view is the last one of its thread view.
* Computed from inverse relation.
*/
threadViewOwnerAsLastMessageView: one('ThreadView', {
inverse: 'lastMessageView',
readonly: true,
}),
},
});
@@ -438,6 +438,8 @@ registerModel({
}),
lastMessageView: one('MessageView', {
compute: '_computeLastMessageView',
inverse: 'threadViewOwnerAsLastMessageView',
readonly: true,
}),
/**
* Most recent message in this ThreadView that has been shown to the