diff --git a/dashboard/src/lib/components/Shell.svelte b/dashboard/src/lib/components/Shell.svelte index 9d4688c..ea288e8 100644 --- a/dashboard/src/lib/components/Shell.svelte +++ b/dashboard/src/lib/components/Shell.svelte @@ -9,7 +9,7 @@ let paletteOpen = $state(false); function handleKeydown(e: KeyboardEvent) { - if (e.key === 'k' && (e.metaKey || e.ctrlKey)) { + if (e.key.toLowerCase() === 'k' && (e.metaKey || e.ctrlKey)) { e.preventDefault(); paletteOpen = !paletteOpen; } diff --git a/dashboard/src/lib/stores/websocket.ts b/dashboard/src/lib/stores/websocket.ts index 1470290..04ab7c6 100644 --- a/dashboard/src/lib/stores/websocket.ts +++ b/dashboard/src/lib/stores/websocket.ts @@ -34,7 +34,7 @@ function getWSUrl(): string { } function connect() { - if (ws?.readyState === WebSocket.OPEN) return; + if (ws && (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING)) return; let socket: WebSocket; try { @@ -63,6 +63,7 @@ function connect() { }; socket.onmessage = (event) => { + if (ws !== socket) return; try { const data: WSEvent = JSON.parse(event.data); lastEvent.set(data); diff --git a/dashboard/src/routes/quest/[id]/+page.svelte b/dashboard/src/routes/quest/[id]/+page.svelte index a942fbf..97dd21e 100644 --- a/dashboard/src/routes/quest/[id]/+page.svelte +++ b/dashboard/src/routes/quest/[id]/+page.svelte @@ -26,6 +26,15 @@ let loading = $state(false); + // Reset data when navigating between quests (component is reused) + $effect(() => { + questName; + dataLoaded = false; + loadFailed = false; + errandList = null; + tomeData = null; + }); + $effect(() => { if (quest && !dataLoaded && !loadFailed && !loading) { loading = true;