fix double ready
This commit is contained in:
parent
70f99a6ffd
commit
917b239647
@ -49,11 +49,6 @@ function InstanceCtrlBtns(args) {
|
|||||||
|
|
||||||
const finished = instance && instance.phase === 'Finished';
|
const finished = instance && instance.phase === 'Finished';
|
||||||
|
|
||||||
const skip = instance.time_control === 'Practice' && instance.phase === 'Lobby';
|
|
||||||
if (skip) {
|
|
||||||
sendReady();
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="instance-ctrl-btns">
|
<div class="instance-ctrl-btns">
|
||||||
<button disabled={!account.subscribed} onClick={() => setChatShow(!chatShow)}>Chat</button>
|
<button disabled={!account.subscribed} onClick={() => setChatShow(!chatShow)}>Chat</button>
|
||||||
|
|||||||
@ -210,13 +210,18 @@ function registerEvents(store) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setInstance(v) {
|
function setInstance(v) {
|
||||||
const { account, instance, ws, tutorial } = store.getState();
|
const { account, ws, tutorial } = store.getState();
|
||||||
if (v) {
|
if (v) {
|
||||||
setInvite(null);
|
setInvite(null);
|
||||||
setPvp(false);
|
setPvp(false);
|
||||||
const player = v.players.find(p => p.id === account.id);
|
const player = v.players.find(p => p.id === account.id);
|
||||||
store.dispatch(actions.setPlayer(player));
|
store.dispatch(actions.setPlayer(player));
|
||||||
|
|
||||||
|
const skip = v.time_control === 'Practice' && v.phase === 'Lobby';
|
||||||
|
if (skip) {
|
||||||
|
ws.sendInstanceReady(v.id);
|
||||||
|
}
|
||||||
|
|
||||||
if (v.phase === 'Finished') {
|
if (v.phase === 'Finished') {
|
||||||
ws.sendAccountInstances();
|
ws.sendAccountInstances();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user