diff --git a/packages/web/src/net.svelte.ts b/packages/web/src/net.svelte.ts index 1121c72..cd6cb30 100644 --- a/packages/web/src/net.svelte.ts +++ b/packages/web/src/net.svelte.ts @@ -507,8 +507,17 @@ class Net { break; } case "error": - if (this.roomIdPending && /no such room|name is taken/.test(msg.message)) { + // "Name is taken" means THIS token was tried and refused: the + // credential itself is dead, and holding it helps nobody. But + // "no such room" proves nothing about the seat — a restarting + // server, a stale restore, or the wrong backend all say it — + // and burning credentials on a transient locked a real player + // out of a live game. The seat stays; the error shows; a later + // reconnect against the right server walks back in. + if (this.roomIdPending && /name is taken/.test(msg.message)) { localStorage.removeItem(SEAT_KEY); + } + if (this.roomIdPending && /no such room|name is taken/.test(msg.message)) { this.roomIdPending = null; } this.error = msg.message;