From a673ea976602041313516752635a12aca8ac0240 Mon Sep 17 00:00:00 2001 From: Eric Wagoner Date: Tue, 13 Oct 2026 18:32:10 -0400 Subject: [PATCH] A seat link replaces a held seat only when the server refuses the held token, not when the connection drops, so a link cannot take a working seat away on a bad connection Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MbtUPJ24P6vc6tE1x6RS3m --- src/routes/join/[code]/+page.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes/join/[code]/+page.svelte b/src/routes/join/[code]/+page.svelte index 22c8320..715f3ac 100644 --- a/src/routes/join/[code]/+page.svelte +++ b/src/routes/join/[code]/+page.svelte @@ -4,7 +4,7 @@ import Board from '$lib/components/Board.svelte'; import ReportSlip from '$lib/components/ReportSlip.svelte'; import TableTalk from '$lib/components/TableTalk.svelte'; - import { rememberSeat, seatFor, seatInLink, trustSeat, type HeldSeat } from '$lib/game/client'; + import { rememberSeat, seatFor, seatInLink, ServerError, trustSeat, type HeldSeat } from '$lib/game/client'; import { COMPACT_QUERY, Duel, NAME_MAX, playerName } from '$lib/game/duel.svelte'; const roomId = $derived((page.params.code ?? '').toUpperCase()); @@ -88,8 +88,10 @@ trustSeat(id); return remote; }); + // Only the server's refusal of the held token lets a link in: a dropped connection is not a lost seat. + const refused = (e: unknown) => e instanceof ServerError && e.status === 403; const arrive = held - ? Duel.resumeRoom(id, held).catch((e: Error) => (sent ? take(sent) : Promise.reject(e))) + ? Duel.resumeRoom(id, held).catch((e: Error) => (sent && refused(e) ? take(sent) : Promise.reject(e))) : sent ? take(sent).catch(() => Duel.watchRoom(id)) : Duel.watchRoom(id);