From b2d4adf5b968e1c52096440f574b4169eb3a1672 Mon Sep 17 00:00:00 2001
From: notoraptor <notoraptor@users.noreply.github.com>
Date: Thu, 25 Jul 2019 16:34:10 -0400
Subject: Add select via shortcut (#61)

- [web][select via dialog] Add shortcuts M and V.
- [web][select via dialog] Asynchronously handle "select via" method, so that shortcut callback can continue to run (and then set its state) without waiting for callback return. This should help to prevent React from updating an unmounted shortcut component.
---
 diplomacy/web/src/gui/pages/content_game.jsx | 6 ++++--
 1 file changed, 4 insertions(+), 2 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 457d901..a98c739 100644
--- a/diplomacy/web/src/gui/pages/content_game.jsx
+++ b/diplomacy/web/src/gui/pages/content_game.jsx
@@ -243,8 +243,10 @@ export class ContentGame extends React.Component {
         this.getPage().dialog(onClose => (
             <SelectViaForm path={orderPath}
                            onSelect={(moveType) => {
-                               this.setSelectedVia(moveType, powerName, orderPath, location);
-                               onClose();
+                               setTimeout(() => {
+                                   this.setSelectedVia(moveType, powerName, orderPath, location);
+                                   onClose();
+                               }, 0);
                            }}
                            onClose={() => {
                                this.clearOrderBuildingPath();
-- 
cgit v1.2.3

