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);