diff --git a/src/client/Main.ts b/src/client/Main.ts index ade475838..6425c137f 100644 --- a/src/client/Main.ts +++ b/src/client/Main.ts @@ -548,7 +548,7 @@ class Client { // Ensure there's a homepage entry in history before adding the lobby entry if (window.location.hash === "" || window.location.hash === "#") { - history.pushState(null, "", window.location.origin + "#refresh"); + history.replaceState(null, "", window.location.origin + "#refresh"); } history.pushState(null, "", `#join=${lobby.gameID}`); }, diff --git a/src/client/graphics/GameRenderer.ts b/src/client/graphics/GameRenderer.ts index 1410cdbbd..50911c8db 100644 --- a/src/client/graphics/GameRenderer.ts +++ b/src/client/graphics/GameRenderer.ts @@ -311,7 +311,11 @@ export class GameRenderer { this.eventBus.on(RedrawGraphicsEvent, () => this.redraw()); this.layers.forEach((l) => l.init?.()); - document.body.appendChild(this.canvas); + // only append the canvas if it's not already in the document to avoid reparenting side-effects + if (!document.body.contains(this.canvas)) { + document.body.appendChild(this.canvas); + } + window.addEventListener("resize", () => this.resizeCanvas()); this.resizeCanvas();