diff --git a/site/src/components/ActivityDetailLoader.svelte b/site/src/components/ActivityDetailLoader.svelte index 91cd3f9..857864e 100644 --- a/site/src/components/ActivityDetailLoader.svelte +++ b/site/src/components/ActivityDetailLoader.svelte @@ -7,9 +7,20 @@ export let base: string = '/'; - let activity: ActivitySummary | null = null; - let notFound = false; - let loading = true; + // Synchronous init — check sessionStorage before first render so "Loading activity…" + // is never shown when navigating from the feed. + const _activityId = window.location.pathname.match(/\/activity\/([^/]+)/)?.[1] ?? null; + let _initial: ActivitySummary | null = null; + if (_activityId) { + try { + const c = sessionStorage.getItem(`bincio:activity:${_activityId}`); + if (c) _initial = JSON.parse(c); + } catch {} + } + + let activity: ActivitySummary | null = _initial; + let notFound = _activityId === null; + let loading = _activityId !== null && _initial === null; /** * Build an ActivitySummary stub from a detail JSON object. @@ -85,11 +96,9 @@ } onMount(async () => { - // Extract activity ID from the URL path: /activity/{id}/ - const match = window.location.pathname.match(/\/activity\/([^/]+)/); - const id = match?.[1]; - if (!id) { notFound = true; loading = false; return; } + if (!loading) return; // fast path: summary already from sessionStorage + const id = _activityId!; try { // Load only the most-recent year shard — avoids downloading all years just // to look up one activity. Falls back to a direct file fetch if not found. diff --git a/site/src/components/ActivityFeed.svelte b/site/src/components/ActivityFeed.svelte index 619cd51..c30bf30 100644 --- a/site/src/components/ActivityFeed.svelte +++ b/site/src/components/ActivityFeed.svelte @@ -350,6 +350,7 @@ { try { sessionStorage.setItem(`bincio:activity:${a.id}`, JSON.stringify(a)); } catch {} }} >{a.title}