diff --git a/web/static/src/ts/store.ts b/web/static/src/ts/store.ts index c9401c45..3da1894e 100644 --- a/web/static/src/ts/store.ts +++ b/web/static/src/ts/store.ts @@ -249,10 +249,13 @@ function actionManagerMixin>(Base: T) { if (!menu) { throw new Error("Invalid menu id"); } - this.updateAppState(menu.app, menu.actionId); + return this.updateAppState(menu.app, menu.actionId); } - private updateAppState(app: MenuItem | null, actionId: number | null) { + private async updateAppState( + app: MenuItem | null, + actionId: number | null + ) { const newApp = app || this.state.currentApp; if (actionId) { const query: Query = { action_id: String(actionId) }; @@ -264,7 +267,7 @@ function actionManagerMixin>(Base: T) { this.update({ currentApp: app }); } this.services.router.navigate(query); - this.doAction(actionId); + return this.doAction(actionId); } else { this.update({ inHome: true, currentApp: newApp }); } @@ -296,9 +299,9 @@ function actionManagerMixin>(Base: T) { return { app, actionId }; } - doAction(request: ActionRequest) { + async doAction(request: ActionRequest) { if (typeof request === "number") { - this.loadAction(request); + await this.loadAction(request); // this is an action ID let name = request === 131 ? "discuss" : "crm"; let title = diff --git a/web/static/tests/store/store.test.ts b/web/static/tests/store/store.test.ts index 5a24c012..41db74c1 100644 --- a/web/static/tests/store/store.test.ts +++ b/web/static/tests/store/store.test.ts @@ -108,7 +108,7 @@ describe("state transitions", () => { // should still be in home menu since no app is currently active expect(store.state.inHome).toBe(true); - store.activateMenuItem(96); + await store.activateMenuItem(96); expect(store.state.inHome).toBe(false); store.toggleHomeMenu();