diff --git a/src/App.svelte b/src/App.svelte index d966eede5..b130181db 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -28,8 +28,7 @@ const activeRouteStore = router.activeRouteStore; - void router.loadFromLocation(); - httpd.initialize(); + void httpd.initialize().finally(() => void router.loadFromLocation()); if (!window.VITEST && !window.PLAYWRIGHT && import.meta.env.PROD) { const plausible = Plausible({ diff --git a/src/lib/httpd.ts b/src/lib/httpd.ts index c005f1685..7a6004a4c 100644 --- a/src/lib/httpd.ts +++ b/src/lib/httpd.ts @@ -147,7 +147,7 @@ function pollSession() { pollHttpdStateHandle = window.setInterval(() => checkState(), 10_000); } -export function initialize() { +export async function initialize() { // Sync session state changes with other open tabs and windows. addEventListener("storage", event => { if ( @@ -159,7 +159,7 @@ export function initialize() { } }); - void checkState(); + await checkState(); // Properly clean up setInterval and restart session polling when Vite // performs hot module reload on file changes. diff --git a/src/views/home/Index.svelte b/src/views/home/Index.svelte index 1715d792e..5e76fa348 100644 --- a/src/views/home/Index.svelte +++ b/src/views/home/Index.svelte @@ -1,12 +1,15 @@