From 24fba9fed710bcde9b15b5712d672f61e192b053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Mon, 3 Aug 2020 10:55:05 +0000 Subject: [FIX] mail: speed up insert by using localId instead of find Part of task-2308312 X-original-commit: 407dc9796543a27b6695c8d4da922c13dece5b38 --- .../static/src/models/thread_cache/thread_cache.js | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'addons/mail/static/src/models/thread_cache') diff --git a/addons/mail/static/src/models/thread_cache/thread_cache.js b/addons/mail/static/src/models/thread_cache/thread_cache.js index b4fe3ca28c3..9d0b4e98e57 100644 --- a/addons/mail/static/src/models/thread_cache/thread_cache.js +++ b/addons/mail/static/src/models/thread_cache/thread_cache.js @@ -94,6 +94,17 @@ function factory(dependencies) { // Private //---------------------------------------------------------------------- + /** + * @override + */ + static _createRecordLocalId(data) { + const { + stringifiedDomain = '[]', + thread: [[commandInsert, thread]], + } = data; + return `${this.modelName}_[${thread.localId}]_<${stringifiedDomain}>`; + } + /** * @private */ @@ -204,18 +215,6 @@ function factory(dependencies) { )]]; } - /** - * @override - */ - _createRecordLocalId(data) { - const { - stringifiedDomain = '[]', - thread: [[commandInsert, thread]], - } = data; - const ThreadCache = this.env.models['mail.thread_cache']; - return `${ThreadCache.modelName}_[${thread.localId}]_<${stringifiedDomain}>`; - } - /** * @private * @param {Array} domain -- cgit v1.2.3