From 5643c8be105caf1e0721a77505fe4ac698895423 Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Mon, 6 Jul 2026 14:22:01 +0200 Subject: [PATCH] fix(offline): AI comms hub opens straight to the Dictionary, not via Chat For an honest-AI (vs_ai) game the comms hub relied on a post-mount $effect to switch from the Chat tab to the Dictionary, so ChatScreen mounted for a beat and fired its chat/state fetch over the network. Online that was a wasted call; offline it threw and raised a 'something went wrong' toast on entering the word-check form (the check itself already worked). Start the comms hub on the Dictionary tab immediately for a vs_ai game, so ChatScreen never mounts. --- ui/src/game/CommsHub.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/game/CommsHub.svelte b/ui/src/game/CommsHub.svelte index 0cac7fe..b2f311f 100644 --- a/ui/src/game/CommsHub.svelte +++ b/ui/src/game/CommsHub.svelte @@ -21,8 +21,11 @@ // Seeded once from the entry route's tab, then owned locally. The effect keeps the tab valid: // an AI game has only the Dictionary; a finished non-AI game has only Chat (a stale Dictionary // deep-link falls back to Chat). + // An honest-AI game has only the Dictionary, so start there regardless of the entry route — this + // keeps ChatScreen (which fetches chat over the network) from mounting even for a beat, which would + // otherwise raise an error toast in offline mode. // svelte-ignore state_referenced_locally - let tab = $state(initialTab); + let tab = $state(vsAi ? 'dictionary' : initialTab); $effect(() => { if (vsAi) tab = 'dictionary'; else if (tab === 'dictionary' && !active) tab = 'chat';