From cfeef1472f78a96b92dccaafd3b681facc27ecfd Mon Sep 17 00:00:00 2001 From: "Didier (did)" Date: Thu, 26 Oct 2023 13:55:49 +0000 Subject: [PATCH] [FIX] mail: cache online and offline getter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this PR online and offline cache getter where called when not needed. This PR move the code inside the onWillRender hook to cache the results and avoid useless computation of getters. task-3572093 closes odoo/odoo#141750 X-original-commit: 57aa00893cc47456d5eb39f429c83c4069ab0d7e Signed-off-by: Alexandre Kühn (aku) --- .../src/discuss/core/common/channel_member_list.js | 6 +++++- .../src/discuss/core/common/channel_member_list.xml | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/addons/mail/static/src/discuss/core/common/channel_member_list.js b/addons/mail/static/src/discuss/core/common/channel_member_list.js index 3c80718abd5..cfca9e26a11 100644 --- a/addons/mail/static/src/discuss/core/common/channel_member_list.js +++ b/addons/mail/static/src/discuss/core/common/channel_member_list.js @@ -3,7 +3,7 @@ import { ImStatus } from "@mail/core/common/im_status"; import { ActionPanel } from "@mail/discuss/core/common/action_panel"; -import { Component, onWillUpdateProps, onWillStart, useState } from "@odoo/owl"; +import { Component, onWillUpdateProps, onWillStart, useState, onWillRender } from "@odoo/owl"; import { _t } from "@web/core/l10n/translation"; import { useService } from "@web/core/utils/hooks"; @@ -23,6 +23,10 @@ export class ChannelMemberList extends Component { this.threadService.fetchChannelMembers(nextProps.thread); } }); + onWillRender(() => { + this.onlineMembers = this.props.thread.onlineMembers; + this.offlineMembers = this.props.thread.offlineMembers; + }); } canOpenChatWith(member) { diff --git a/addons/mail/static/src/discuss/core/common/channel_member_list.xml b/addons/mail/static/src/discuss/core/common/channel_member_list.xml index fd3f55d8c59..ea4086a3a2c 100644 --- a/addons/mail/static/src/discuss/core/common/channel_member_list.xml +++ b/addons/mail/static/src/discuss/core/common/channel_member_list.xml @@ -4,19 +4,19 @@ - +
Online - - +
- + - +
Offline - - +
- + And 1 other member. And other members.