From 93078feeab5ace55210e34489192c04c3490b8a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Wed, 21 Feb 2024 19:10:18 +0100 Subject: [PATCH] [FIX] mail: cache access to message_unread_counter Store in variable in sort instead of accessing twice (less proxy get) Part-of: odoo/odoo#155068 --- addons/mail/static/src/core/common/store_service.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/core/common/store_service.js b/addons/mail/static/src/core/common/store_service.js index 46bda9c4717..311ca692b6b 100644 --- a/addons/mail/static/src/core/common/store_service.js +++ b/addons/mail/static/src/core/common/store_service.js @@ -132,10 +132,12 @@ export class Store extends BaseStore { if (bNeedaction > 0 && aNeedaction === 0) { return 1; } - if (a.message_unread_counter > 0 && b.message_unread_counter === 0) { + const aUnread = a.message_unread_counter; + const bUnread = b.message_unread_counter; + if (aUnread > 0 && bUnread === 0) { return -1; } - if (b.message_unread_counter > 0 && a.message_unread_counter === 0) { + if (bUnread > 0 && aUnread === 0) { return 1; } if (