Fix infinite loop of 'game not found' errors in a certain situation

This commit is contained in:
Andrio Celos 2024-03-12 13:27:30 +11:00
parent 0b57a48de3
commit ef8f5a700d
2 changed files with 4 additions and 1 deletions

View File

@ -276,6 +276,7 @@ function joinGameError(message: string, fromInitialLoad: boolean) {
if (fromInitialLoad)
clearPreGameForm(true);
else {
showPage('preGame');
gameIDBox.focus();
gameIDBox.setSelectionRange(0, gameIDBox.value.length);
}

View File

@ -269,8 +269,10 @@ function setupWebSocket(gameID: string) {
}
setLoadingMessage(null);
if (!payload.data) {
joinGameError('The game was not found.', false);
currentGame = null;
webSocket.removeEventListener('close', webSocket_close);
webSocket.close();
alert('The game was not found.');
} else {
currentGame = {
id: gameID,