diff options
Diffstat (limited to 'web/src/App.svelte')
| -rw-r--r-- | web/src/App.svelte | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/web/src/App.svelte b/web/src/App.svelte index bdeb998..814a47a 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -13,6 +13,7 @@ import { onMount, onDestroy } from 'svelte'; import { get } from 'svelte/store'; import { GameSession } from '$lib/state/session'; + import { establishSessionCookie } from '$lib/protocol/session'; import { clientSettings, styleTheme } from '$lib/settings'; import { gameData, type CampaignData, type MonsterData } from '$lib/data/gameData'; import { @@ -57,7 +58,12 @@ const session = new GameSession(); - onMount(() => session.connect()); + // Establish the persistent session cookie before the WS connects, so the + // upgrade carries it and the seat survives reloads and server restarts. + onMount(async () => { + await establishSessionCookie(); + session.connect(); + }); onDestroy(() => session.disconnect()); const gameState = session.state; |
