diff --git a/packages/client/src/lib/Game.svelte b/packages/client/src/lib/Game.svelte index 6697d1b..fd67ca1 100644 --- a/packages/client/src/lib/Game.svelte +++ b/packages/client/src/lib/Game.svelte @@ -110,14 +110,17 @@ return a && phantomDrag.state.moved ? a.type : null; }); - // Load the phantom layer once `you` is known (blind games only). - let phantomsLoaded = $state(false); + // Load the phantom layer when `you` is known (blind games only). Keyed on + // gameId — like the connection effect — so it reloads if this + // instance is reused for a different game without a remount. + let loadedFor: string | null = $state(null); $effect(() => { - if (phantomsLoaded) return; + const id = gameId; const you = game.state.you; + if (loadedFor === id) return; if (you && game.state.mode === 'blind') { - untrack(() => phantoms.loadForGame(gameId, you)); - phantomsLoaded = true; + untrack(() => phantoms.loadForGame(id, you)); + loadedFor = id; } }); @@ -210,7 +213,7 @@ {/if} -{#if dragGhost} +{#if phantomLayerEnabled && dragGhost}