diff --git a/src/components/stores/journalStream.ts b/src/components/stores/journalStream.ts index ee04dfa..e13a9be 100644 --- a/src/components/stores/journalStream.ts +++ b/src/components/stores/journalStream.ts @@ -154,6 +154,12 @@ function handlePatch(patch: WorkerPatch): void { s.players = patch.state.players; }), ); + // Persist name/role so URL and localStorage stay in sync + if (patch.state.myName) { + saveName(patch.state.myName); + syncUrlParam("player", patch.state.myName); + } + saveRole(patch.state.myRole); // Rebuild derived state (revealedPaths, stats) by replaying reducers replayReducers(); break; diff --git a/src/workers/journal.worker.ts b/src/workers/journal.worker.ts index 0b4a875..126afa3 100644 --- a/src/workers/journal.worker.ts +++ b/src/workers/journal.worker.ts @@ -190,6 +190,7 @@ async function connectStream( ); notifySubscribers({ type: "connectionStatus", status: "connected" }); + broadcastFullState(); resolve(); });