diff options
| author | Julien Mougenot <jum@odoo.com> | 2020-07-31 11:50:56 +0000 |
|---|---|---|
| committer | Julien Mougenot <jum@odoo.com> | 2020-08-04 12:44:18 +0000 |
| commit | cc6a60bec935a42e19bac0bef5771dfcbad81f83 (patch) | |
| tree | ea234a9eb85b55cd12cae650fc5782cbb30325d1 /addons/web/static/src/js/views/abstract_view.js | |
| parent | 6e780b2e4f69cdee247afe4be964227a90b3d738 (diff) | |
[IMP] web: Optimize action model loading
The loading of the action model extensions have been split in this
commit:
- when calling load, a first promise is returned. It is meant to be
resolved as soon as all the query informations are available.
- a second promise returned by a new method "isReady" is resolved when
all of the extension data have been fetched.
This difference allow to not wait for server calls irrelevant for the
query. By default "isReady" will always wait for a full load call, but
this is meant to be overridden in case optimisations can be made.
Diffstat (limited to 'addons/web/static/src/js/views/abstract_view.js')
| -rw-r--r-- | addons/web/static/src/js/views/abstract_view.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/addons/web/static/src/js/views/abstract_view.js b/addons/web/static/src/js/views/abstract_view.js index 04b1b781848..129cb6817b3 100644 --- a/addons/web/static/src/js/views/abstract_view.js +++ b/addons/web/static/src/js/views/abstract_view.js @@ -306,13 +306,16 @@ var AbstractView = Factory.extend({ */ getController: async function () { const _super = this._super.bind(this); - await this.controllerParams.searchModel.load(); - const query = this.controllerParams.searchModel.get('query'); - this._updateMVCParams(query); + const { searchModel } = this.controllerParams; + await searchModel.load(); + this._updateMVCParams(searchModel.get("query")); // get the parent of the model if it already exists, as _super will // set the new controller as parent, which we don't want const modelParent = this.model && this.model.getParent(); - const controller = await _super(...arguments); + const [controller] = await Promise.all([ + _super(...arguments), + searchModel.isReady(), + ]); if (modelParent) { // if we already add a model, restore its parent this.model.setParent(modelParent); |
