Stage 17 #2: Connecting indicator + auto-retry (no more red toasts) #29
Reference in New Issue
Block a user
Delete Branch "feature/connecting-indicator"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Replaces the red "Connection problem / Retrying…" toast with connectivity state.
Indicator: a global
onlinesignal (lib/connection.svelte.ts) flips on a transportunavailable/rate_limited(and on the live stream's drop), and the header swaps its title for a pure-CSS spinner + "Connecting…" (an arc with a gap, no bundled graphics). The in-game server actions (commit / exchange / pass / hint) soft-disable; local board / rack / reset stay live.Auto-retry (your choice):
execretries with capped exponential backoff — every op on a rate-limit (rejected before processing → safe), reads only onunavailable. A mutation is never blindly re-sent on a dropped connection (its response could have been lost after the backend applied it) — its button is disabled while offline and you re-issue it on reconnect. The idempotency caveat you accepted.Recovery: a reachability watcher (
profile.getprobe) and any successful traffic clear the signal. A server-data screen (profile/stats/friends) still opens with the spinner and fills on reconnect (global indicator + read auto-retry) — navigation is never dead, matching your "open with spinner" pick.Tests: pure retry policy unit-tested (
retry.ts); a mock-onlywindow.__connhook drives a Chromium+WebKit e2e (indicator shows offline, action disables, both clear on reconnect). Full e2e suite (72) + unit (121) + build green.Also records #1 as investigated → no change (the bot already drains every delivered update; you chose to leave
allowed_updatesat the default).Note: other server-action buttons (chat send, profile save, …) are not yet visually disabled but degrade to a safe no-op offline (suppressed toast + indicator). Easy to extend if you want them greyed too — say the word.
Following the in-game bar, the Connecting indicator now also visually disables the other proactive (server-sending) controls while offline: chat send + nudge, profile save / link email|telegram / merge-confirm, friends (redeem, get-code, accept/decline, unfriend, block, unblock), New Game (auto-match variant + send-invitation) and the lobby hide ❌. Purely local controls (board/rack/reset, menus, navigation, settings, copy-code) stay live. Each reads the global connection.online signal; full e2e + check green.