diff options
| author | Sébastien Theys <seb@odoo.com> | 2021-01-18 16:49:01 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2021-01-18 16:59:02 +0000 |
| commit | e995f03a9a55280b1e9173223cdfa619ae164cc3 (patch) | |
| tree | 3aefcd4e4621f11cc971a652d7ed6f01a70765c0 /addons/mail/static/src/models/thread/thread.js | |
| parent | 20d6efa817a4d839777c81d403bb8770807e784a (diff) | |
[FIX] mail, im_livechat, snailmail: use findFromIdentifyingData
find is O(n) and findFromIdentifyingData is O(1)
task-2440693
closes odoo/odoo#64712
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/thread/thread.js')
| -rw-r--r-- | addons/mail/static/src/models/thread/thread.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index 6135a8802c3..23256c62e7d 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -547,14 +547,10 @@ function factory(dependencies) { * @returns {mail.thread_cache} */ cache(stringifiedDomain = '[]') { - let cache = this.caches.find(cache => cache.stringifiedDomain === stringifiedDomain); - if (!cache) { - cache = this.env.models['mail.thread_cache'].create({ - stringifiedDomain, - thread: [['link', this]], - }); - } - return cache; + return this.env.models['mail.thread_cache'].insert({ + stringifiedDomain, + thread: [['link', this]], + }); } /** |
