From 917b239647d6d74a8a37d3c4a02dd667c114e80c Mon Sep 17 00:00:00 2001 From: ntr Date: Wed, 13 Nov 2019 21:37:53 +1100 Subject: [PATCH] fix double ready --- client/src/components/instance.ctrl.btns.jsx | 5 ----- client/src/events.jsx | 7 ++++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/src/components/instance.ctrl.btns.jsx b/client/src/components/instance.ctrl.btns.jsx index c4130385..45c26e1f 100644 --- a/client/src/components/instance.ctrl.btns.jsx +++ b/client/src/components/instance.ctrl.btns.jsx @@ -49,11 +49,6 @@ function InstanceCtrlBtns(args) { const finished = instance && instance.phase === 'Finished'; - const skip = instance.time_control === 'Practice' && instance.phase === 'Lobby'; - if (skip) { - sendReady(); - } - return (
diff --git a/client/src/events.jsx b/client/src/events.jsx index 073c2ffc..ab634d98 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -210,13 +210,18 @@ function registerEvents(store) { } function setInstance(v) { - const { account, instance, ws, tutorial } = store.getState(); + const { account, ws, tutorial } = store.getState(); if (v) { setInvite(null); setPvp(false); const player = v.players.find(p => p.id === account.id); store.dispatch(actions.setPlayer(player)); + const skip = v.time_control === 'Practice' && v.phase === 'Lobby'; + if (skip) { + ws.sendInstanceReady(v.id); + } + if (v.phase === 'Finished') { ws.sendAccountInstances(); }