diff --git a/packages/client/src/lib/stores/phantoms.svelte.ts b/packages/client/src/lib/stores/phantoms.svelte.ts index a2e6ecf..e351e93 100644 --- a/packages/client/src/lib/stores/phantoms.svelte.ts +++ b/packages/client/src/lib/stores/phantoms.svelte.ts @@ -38,11 +38,13 @@ function makeStore() { } function place(sq: Square, type: PieceType) { + if (!gameId) return; state.phantoms = { ...state.phantoms, [sq]: { color: oppColor, type } }; persist(); } function move(from: Square, to: Square) { + if (!gameId || from === to) return; const p = state.phantoms[from]; if (!p) return; const next = { ...state.phantoms }; @@ -53,6 +55,7 @@ function makeStore() { } function remove(sq: Square) { + if (!gameId) return; const next = { ...state.phantoms }; delete next[sq]; state.phantoms = next;