From 45830f6cd91f71c11508c238ebe2f1e112f289c3 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 28 Aug 2023 11:14:15 +0200 Subject: [PATCH] Show local projects instead of network to landing page, if available Signed-off-by: Sebastian Martinez --- src/App.svelte | 3 +-- src/lib/httpd.ts | 4 ++-- src/views/home/Index.svelte | 12 ++++++++++-- src/views/home/router.ts | 13 ++++++++++++- tests/e2e/landingPage.spec.ts | 2 +- tests/support/fixtures.ts | 4 ++-- tests/visual/landingPage.spec.ts | 2 +- 7 files changed, 29 insertions(+), 11 deletions(-) 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 @@