diff options
| author | Lucas Perais (lpe) <lpe@odoo.com> | 2020-06-11 15:08:34 +0000 |
|---|---|---|
| committer | Lucas Perais (lpe) <lpe@odoo.com> | 2020-06-12 08:26:40 +0000 |
| commit | eaa37eaf84ebbe540f4e78b94540a1e2f6c88c07 (patch) | |
| tree | 0684c00b437b45ab0dd12c3f66b997b3fb83ce01 /addons/web/static/src/js/fields/basic_fields.js | |
| parent | 07a3d7f31e5a77b9ff65c52d0292d7ee4595e5e4 (diff) | |
[FIX] web: force webclient to finalize its loading
When the web client is completely ready, it triggers an event "web_client_ready" on the bus
Some Mail OWL components rely on that mechanism to be mounted
i.e. DialogManager and ChatWindowManager
When eveluating the action to display at startup, the webclient mechanism
implies that we push the location hash each time a relevant data is available
e.g. menu_id etc...
Now, before this commit, since the hashchange handler is bound before that evaluation
it is actually triggered each time the JQuery bbq pushed a url state (this is in the API)
doc: http://benalman.com/code/projects/jquery-bbq/docs/files/jquery-ba-bbq-js.html#jQuery.bbq.pushState
This undercuts the initial loading promise chain to finish and the event "web_client_ready" was never triggered
preventing everything that relied on it to be mounted
After this commit, the webclient is artificially finalized, with the help of a new custom event
"webclient_started". So the event web_client_ready is triggered,
signalling to everyone it is in the dom and usable
A lot of bug persist though: the start() of webClient sometimes returns a rejected promise
It is worth noting that the hashchange mechanism is largely outdated and will change
in a more reliable way in the near future with the conversion of the webClient to OWL
the drop of JQuery BBQ and the direct reliance on window.history.pushState
doc: https://developer.mozilla.org/en-US/docs/Web/API/History/pushState#:~:text=The%20state%20object%20is%20a,the%20history%20entry's%20state%20object.
and on the window's "popstate" event
doc: https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event
This commit must be applied on the enterprise webclient too
closes odoo/odoo#52892
Related: odoo/enterprise#11114
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
0 files changed, 0 insertions, 0 deletions
