diff options
author | notoraptor <notoraptor@users.noreply.github.com> | 2019-07-25 16:34:10 -0400 |
---|---|---|
committer | Philip Paquette <pcpaquette@gmail.com> | 2019-07-25 16:34:10 -0400 |
commit | b2d4adf5b968e1c52096440f574b4169eb3a1672 (patch) | |
tree | 8b2cf2a88bb8003d995f907bf73ca05068c4cb65 /diplomacy/web/src/gui/pages/content_game.jsx | |
parent | 48ee1a065debde5027fc17e49144d348258dc5e4 (diff) |
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.
Diffstat (limited to 'diplomacy/web/src/gui/pages/content_game.jsx')
-rw-r--r-- | diplomacy/web/src/gui/pages/content_game.jsx | 6 |
1 files changed, 4 insertions, 2 deletions
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(); |