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 <noreply@anthropic.com>
This commit is contained in:
1 parent
bca4d5eba7
commit
3a9f39780b
1 file changed
+14
-2
@@ -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));
|
||||
|
||||
Reference in new issue
Block a user