[FIX] web: remove race condition at webclient startup

Before this rev., there was a race condition making some tours
randomly fail on runbot, when the following steps occurred in that
order:
  - load webclient
  - as soon as the menu is ready and visible, click on a root menu
    which thus leads to a doAction
  - in the meantime, an RPC is done by the webclient to retrieve
    the (optional) default action of the user (if there is no
    state in the url, which is the case for tours in general)
  - when that RPC returns, this action (if any), or the action of
    the first menu is executed, thus leading to a second doAction
  - the ActionManager using a DropPrevious, the first doAction is
    dropped and thus the action linked to the clicked menu is
    never shown, making the tour fail

This rev. uses the state of the ActionManager's DropPrevious to
prevent the default action from being executed if another action
is already being executed, thus removing that race condition.

Note that this fix is temporary, as the community webclient is
currently being refactored.
This commit is contained in:
Aaron Bohy
2018-09-12 13:30:24 +02:00
parent 0abae675e8
commit 18bd4fa749
@@ -107,7 +107,8 @@ return AbstractWebClient.extend({
args: [[session.uid], ['action_id']],
})
.done(function(result) {
if (didHashChanged) {
var amDef = self.action_manager.dp.current_def;
if (didHashChanged || (amDef && amDef.state() === 'pending')) {
return;
}
var data = result[0];