From 7f9af5747c7b650b6cf4ab894bdd0b113e77a78b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Thu, 21 Jan 2021 17:43:49 +0000 Subject: [FIX] mail, *: significantly reduce number of useless renders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * = hr_holidays, im_livechat, website_livechat A huge amount of components where rendered for no reason, notably when typing a new message (at every key press), which significantly slowed down the interface. There were 2 causes to this number of renders: - OWL rendering all children automatically, even if their props didn't change, unless `shouldUpdate` is overridden, which is now done. - `useStore` selectors being way too generous in what they observed task-2399731 closes odoo/odoo#62703 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/components/thread_preview/thread_preview.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'addons/mail/static/src/components/thread_preview/thread_preview.js') diff --git a/addons/mail/static/src/components/thread_preview/thread_preview.js b/addons/mail/static/src/components/thread_preview/thread_preview.js index 92fcb6101d1..94df29e0e67 100644 --- a/addons/mail/static/src/components/thread_preview/thread_preview.js +++ b/addons/mail/static/src/components/thread_preview/thread_preview.js @@ -5,6 +5,7 @@ const components = { MessageAuthorPrefix: require('mail/static/src/components/message_author_prefix/message_author_prefix.js'), PartnerImStatusIcon: require('mail/static/src/components/partner_im_status_icon/partner_im_status_icon.js'), }; +const useShouldUpdateBasedOnProps = require('mail/static/src/component_hooks/use_should_update_based_on_props/use_should_update_based_on_props.js'); const useStore = require('mail/static/src/component_hooks/use_store/use_store.js'); const mailUtils = require('mail.utils'); @@ -18,6 +19,7 @@ class ThreadPreview extends Component { */ constructor(...args) { super(...args); + useShouldUpdateBasedOnProps(); useStore(props => { const thread = this.env.models['mail.thread'].get(props.threadLocalId); let lastMessageAuthor; -- cgit v1.2.3