diff options
author | notoraptor <notoraptor@users.noreply.github.com> | 2019-07-19 07:54:43 -0400 |
---|---|---|
committer | Philip Paquette <pcpaquette@gmail.com> | 2019-07-19 07:54:43 -0400 |
commit | 978b51fccb428c76b5d912ab748a313efa18676a (patch) | |
tree | 43a3baf3335ebcf66c84e3042efed7b40a4a2950 /diplomacy/web/src | |
parent | 33105a895a0b3c2b266c66058f5a8ec930c88504 (diff) |
[web] Update state correctly when a power is kicked. (#54)
Diffstat (limited to 'diplomacy/web/src')
-rw-r--r-- | diplomacy/web/src/gui/pages/content_game.jsx | 14 |
1 files changed, 8 insertions, 6 deletions
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); } |