fixes lol
All checks were successful
Build and Push / build-all (push) Successful in 2m6s

This commit is contained in:
doomtube 2026-01-10 18:26:11 -05:00
parent 958460db98
commit 42b75ecf2f
2 changed files with 15 additions and 4 deletions

View file

@ -374,9 +374,20 @@
});
}
function handleClose() {
if ($gamesOverlay.matchId) {
nakama.leaveMatch($gamesOverlay.matchId);
async function handleClose() {
const matchId = $gamesOverlay.matchId;
const mode = $gameMode;
// If this is a waiting challenge we created, cancel it properly
// (myColor === 'w' means we're white, which means we created the challenge)
if (matchId && mode === 'waiting' && myColor === 'w') {
try {
await nakama.cancelChallenge(matchId);
} catch (e) {
console.error('Failed to cancel challenge:', e);
}
} else if (matchId) {
nakama.leaveMatch(matchId);
}
if (unsubscribeMatch) {