From 978b51fccb428c76b5d912ab748a313efa18676a Mon Sep 17 00:00:00 2001
From: notoraptor <notoraptor@users.noreply.github.com>
Date: Fri, 19 Jul 2019 07:54:43 -0400
Subject: [web] Update state correctly when a power is kicked. (#54)

---
 diplomacy/web/src/gui/pages/content_game.jsx | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

(limited to 'diplomacy/web/src/gui/pages/content_game.jsx')

diff --git a/diplomacy/web/src/gui/pages/content_game.jsx b/diplomacy/web/src/gui/pages/content_game.jsx
index 2941b6b..f37bdca 100644
--- a/diplomacy/web/src/gui/pages/content_game.jsx
+++ b/diplomacy/web/src/gui/pages/content_game.jsx
@@ -334,12 +334,14 @@ export class ContentGame extends React.Component {
             || !networkGame.channel.game_id_to_instances[networkGame.local.game_id].has(networkGame.local.role)
         )) {
             // This power game is now invalid.
-            this.getPage().disconnectGame(networkGame.local.game_id);
-            if (this.networkGameIsDisplayed(networkGame)) {
-                const page = this.getPage();
-                page.loadGames(
-                    {error: `${networkGame.local.game_id}/${networkGame.local.role} was kicked. Deadline over?`});
-            }
+            this.getPage().disconnectGame(networkGame.local.game_id)
+                .then(() => {
+                    if (this.networkGameIsDisplayed(networkGame)) {
+                        const page = this.getPage();
+                        page.loadGames(
+                            {error: `${networkGame.local.game_id}/${networkGame.local.role} was kicked. Deadline over?`});
+                    }
+                });
         } else {
             this.notifiedNetworkGame(networkGame, notification);
         }
-- 
cgit v1.2.3

