From 18bd4fa7499e426f51e3dd80f1d91fa0f3da0111 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Tue, 11 Sep 2018 20:48:38 +0200 Subject: [PATCH] [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. --- addons/web/static/src/js/chrome/web_client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/chrome/web_client.js b/addons/web/static/src/js/chrome/web_client.js index 622d9d681ec..ca777d470ae 100644 --- a/addons/web/static/src/js/chrome/web_client.js +++ b/addons/web/static/src/js/chrome/web_client.js @@ -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];