fix(offline): route word-check through the game source; reload lobby on offline flip
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 1m11s
CI / conformance (pull_request) Successful in 9s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m40s

Two offline bugs found on the contour:
- The word-check screen (CheckScreen) called gateway.gameState/checkWord
  directly, so in an offline (local) game it hit the network and errored
  ("something went wrong"). Route both through gameSource(id) — the local
  source answers from the device dawg. The complaint control (online-only,
  no offline backend) is hidden for a local game.
- The lobby did not react to the offline-mode toggle (which lives in Settings,
  so the lobby can stay mounted): an online game lingered until the next
  reload. Reload on an offlineMode flip so entering offline immediately shows
  only device-local games.

Cold offline launch hanging on the splash (boot still fetches the profile over
the network) is the separate C2 offline-boot follow-up (needs a persisted
profile + a boot short-circuit).
This commit is contained in:
Ilia Denisov
2026-07-06 14:04:23 +02:00
parent ef832b823d
commit 2f70ef1b85
2 changed files with 23 additions and 4 deletions
+12
View File
@@ -101,6 +101,18 @@
// over the slower live stream; gating it keeps the card, its blink and the toast on one event.
if (app.lastEvent && app.lastEvent.kind !== 'heartbeat') void load();
});
// Reload when the deliberate offline mode flips (the toggle lives in Settings, so the lobby can
// stay mounted across the change): entering offline must immediately drop the online games and
// show only the device-local ones, and leaving it must refetch the online lobby. Guarded so the
// initial run — already covered by onMount — does not double-load.
let wasOffline = offlineMode.active;
$effect(() => {
const now = offlineMode.active;
if (now !== wasOffline) {
wasOffline = now;
void load();
}
});
const myId = $derived(app.session?.userId ?? '');
const groups = $derived(groupGames(games, myId, app.chatUnread));