From 3a9f39780b251902837e62d9c837c559a739b86f Mon Sep 17 00:00:00 2001 From: Eric Wagoner Date: Sat, 31 Oct 2026 12:07:13 -0400 Subject: [PATCH] A wallet that lost the seat last sat in takes it back on load The cap that dropped the newest seat left wallets without the very seat their browser was sitting in, so a reload landed in the Peanut Gallery. That seat is also kept on its own; loading the wallet now restores it from there when it is missing. Co-Authored-By: Claude Opus 5.5 --- packages/web/src/net.svelte.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/web/src/net.svelte.ts b/packages/web/src/net.svelte.ts index d8b278f..ffb1ada 100644 --- a/packages/web/src/net.svelte.ts +++ b/packages/web/src/net.svelte.ts @@ -350,8 +350,20 @@ export function attentionLabel(a: GameSummary["attention"]): string { } function loadSeats(): Seat[] { - try { return JSON.parse(localStorage.getItem(SEATS_KEY) ?? "[]"); } - catch { return []; } + let seats: Seat[]; + try { seats = JSON.parse(localStorage.getItem(SEATS_KEY) ?? "[]"); } + catch { seats = []; } + // The seat last sat in is kept on its own as well. A wallet that lost + // it (a cap that once dropped the newest seat) takes it back from there. + try { + const last = JSON.parse(localStorage.getItem(SEAT_KEY) ?? "null") as Seat | null; + if (last?.roomId && last.name && last.token && + !seats.some((s) => s.roomId === last.roomId && s.name === last.name)) { + seats = [last, ...seats]; + saveSeats(seats); + } + } catch { /* an unreadable last seat adds nothing */ } + return seats; } function saveSeats(seats: Seat[]): void { localStorage.setItem(SEATS_KEY, JSON.stringify(seats));