fix double ready

This commit is contained in:
ntr 2019-11-13 21:37:53 +11:00
parent 70f99a6ffd
commit 917b239647
2 changed files with 6 additions and 6 deletions

View File

@ -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 (
<div class="instance-ctrl-btns">
<button disabled={!account.subscribed} onClick={() => setChatShow(!chatShow)}>Chat</button>

View File

@ -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();
}