diff options
| author | Sébastien Theys <seb@odoo.com> | 2021-01-20 17:12:01 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2021-01-20 17:12:01 +0000 |
| commit | 0e9fb00f7863593fa63a3adf2593fb48dfb168b1 (patch) | |
| tree | 72e3add4dea96c5c7ee11eca0a44a237a32bf563 /addons/mail/static/src/models/thread_view/thread_viewer.js | |
| parent | 6532c6ba7acb2de53fc839d5a7c5d8b200716565 (diff) | |
[FIX] mail: more consistent async handling of scroll feature
task-2333535
task-2388676
closes odoo/odoo#64505
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/thread_view/thread_viewer.js')
| -rw-r--r-- | addons/mail/static/src/models/thread_view/thread_viewer.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/addons/mail/static/src/models/thread_view/thread_viewer.js b/addons/mail/static/src/models/thread_view/thread_viewer.js index 1e48e4ad805..c78022d4a53 100644 --- a/addons/mail/static/src/models/thread_view/thread_viewer.js +++ b/addons/mail/static/src/models/thread_view/thread_viewer.js @@ -14,9 +14,11 @@ function factory(dependencies) { /** * @param {integer} scrollHeight + * @param {mail.thread_cache} threadCache */ - saveThreadCacheScrollHeightAsInitial(scrollHeight) { - if (!this.threadCache) { + saveThreadCacheScrollHeightAsInitial(scrollHeight, threadCache) { + threadCache = threadCache || this.threadCache; + if (!threadCache) { return; } if (this.chatter) { @@ -27,16 +29,18 @@ function factory(dependencies) { } this.update({ threadCacheInitialScrollHeights: Object.assign({}, this.threadCacheInitialScrollHeights, { - [this.threadCache.localId]: scrollHeight, + [threadCache.localId]: scrollHeight, }), }); } /** * @param {integer} scrollTop + * @param {mail.thread_cache} threadCache */ - saveThreadCacheScrollPositionsAsInitial(scrollTop) { - if (!this.threadCache) { + saveThreadCacheScrollPositionsAsInitial(scrollTop, threadCache) { + threadCache = threadCache || this.threadCache; + if (!threadCache) { return; } if (this.chatter) { @@ -47,7 +51,7 @@ function factory(dependencies) { } this.update({ threadCacheInitialScrollPositions: Object.assign({}, this.threadCacheInitialScrollPositions, { - [this.threadCache.localId]: scrollTop, + [threadCache.localId]: scrollTop, }), }); } |
