From 06b18892e469768a9026c1a01fe691246ec01408 Mon Sep 17 00:00:00 2001 From: Scott Anderson <662325+scottanderson@users.noreply.github.com> Date: Mon, 23 Jun 2025 12:42:22 -0400 Subject: [PATCH] Fix singleplayer check (#1260) ## Description: Fix a broken check for singleplayer that relied on the `any` type to mask undefined field access. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors --- src/client/Main.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/Main.ts b/src/client/Main.ts index 9ba4b94af..a1862e947 100644 --- a/src/client/Main.ts +++ b/src/client/Main.ts @@ -327,8 +327,8 @@ class Client { } } - private async handleJoinLobby(event: CustomEvent) { - const lobby = event.detail as JoinLobbyEvent; + private async handleJoinLobby(event: CustomEvent) { + const lobby = event.detail; console.log(`joining lobby ${lobby.gameID}`); if (this.gameStop !== null) { console.log("joining lobby, stopping existing game"); @@ -403,7 +403,7 @@ class Client { (ad as HTMLElement).style.display = "none"; }); - if (event.detail.gameConfig?.gameType !== GameType.Singleplayer) { + if (lobby.gameStartInfo?.config.gameType !== GameType.Singleplayer) { history.pushState(null, "", `#join=${lobby.gameID}`); } },