diff options
| author | Sébastien Theys <seb@odoo.com> | 2021-01-21 17:43:49 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2021-01-21 17:43:49 +0000 |
| commit | 7f9af5747c7b650b6cf4ab894bdd0b113e77a78b (patch) | |
| tree | 5152dca1d14355e7c7465b41fcbe9c80770e98a6 /addons/mail/static/src/components/editable_text | |
| parent | 47bfdf0592a5dd93870ca1a9da326351d70087bb (diff) | |
[FIX] mail, *: significantly reduce number of useless renders
* = 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) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/components/editable_text')
| -rw-r--r-- | addons/mail/static/src/components/editable_text/editable_text.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/addons/mail/static/src/components/editable_text/editable_text.js b/addons/mail/static/src/components/editable_text/editable_text.js index 6e0b682fc53..be7e7ddc506 100644 --- a/addons/mail/static/src/components/editable_text/editable_text.js +++ b/addons/mail/static/src/components/editable_text/editable_text.js @@ -2,11 +2,17 @@ odoo.define('mail/static/src/components/editable_text/editable_text.js', functio 'use strict'; const { markEventHandled } = require('mail/static/src/utils/utils.js'); +const useShouldUpdateBasedOnProps = require('mail/static/src/component_hooks/use_should_update_based_on_props/use_should_update_based_on_props.js'); const { Component } = owl; class EditableText extends Component { + constructor(...args) { + super(...args); + useShouldUpdateBasedOnProps(); + } + mounted() { this.el.focus(); this.el.setSelectionRange(0, (this.el.value && this.el.value.length) || 0); |
