From 6f6078187b29843228fcfb14a9b76f9da0bf5a00 Mon Sep 17 00:00:00 2001 From: NewHappyRabbit <31893343+NewHappyRabbit@users.noreply.github.com> Date: Tue, 18 Feb 2025 01:10:26 +0200 Subject: [PATCH] Fixed a bug where if you joined a private lobby through a link and then tried to exit the game through the 'X' button, it will reload the page and rejoin the lobby --- src/client/graphics/layers/OptionsMenu.ts | 3 ++- src/client/graphics/layers/WinModal.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client/graphics/layers/OptionsMenu.ts b/src/client/graphics/layers/OptionsMenu.ts index 38c28af25..b025f4860 100644 --- a/src/client/graphics/layers/OptionsMenu.ts +++ b/src/client/graphics/layers/OptionsMenu.ts @@ -52,7 +52,8 @@ export class OptionsMenu extends LitElement implements Layer { private hasWinner = false; private onExitButtonClick() { - window.location.reload(); + // redirect to the home page + window.location.href = "/"; } createRenderRoot() { diff --git a/src/client/graphics/layers/WinModal.ts b/src/client/graphics/layers/WinModal.ts index c68b0cad1..9dc7c6f6e 100644 --- a/src/client/graphics/layers/WinModal.ts +++ b/src/client/graphics/layers/WinModal.ts @@ -287,7 +287,7 @@ export class WinModal extends LitElement implements Layer { private _handleExit() { this.hide(); - window.location.reload(); + window.location.href = "/"; } init() {