[FIX] mail: fix race conditions, especially with scroll

The `_update` of some components must take place before the `_update`
of other (usually sibling) components that might directly influence their
layout. This is in particular the case for `_update` that are relying on height.

Prevent force save of scroll position if there are pending hints to adjust it,
and prevent pending hints from overriding new scroll value.

Prevent flicker with message date.

This should fix all known issues related to incorrectly saving or restoring
scroll position.

task-2344226
task-2358066
task-2369332
task-2372339
task-2373741

closes odoo/odoo#61791

X-original-commit: 2002c6a599a685f4a18fc670a9f7992c8d595c0f
Related: odoo/enterprise#14759
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Sébastien Theys
2020-11-16 15:40:10 +00:00
parent c65e284dcc
commit 91bbdf41f4
27 changed files with 675 additions and 379 deletions
@@ -30,13 +30,13 @@ function factory(dependencies) {
extraDomain: [['id', '<', Math.min(...messageIds)]],
limit,
}));
for (const threadView of this.threadViews) {
threadView.addComponentHint('more-messages-loaded', { fetchedMessages });
}
this.update({ isLoadingMore: false });
if (fetchedMessages.length < limit) {
this.update({ isAllHistoryLoaded: true });
}
for (const threadView of this.threadViews) {
threadView.addComponentHint('more-messages-loaded', { fetchedMessages });
}
return fetchedMessages;
}
@@ -165,7 +165,7 @@ function factory(dependencies) {
* @returns {mail.message[]}
*/
_computeNonEmptyMessages() {
return [['replace', this.messages.filter(message => !message.isEmpty)]]
return [['replace', this.messages.filter(message => !message.isEmpty)]];
}
/**