aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-04-22 09:18:25 +0530
committerBobby <[email protected]>2026-04-22 09:18:25 +0530
commit6e3be3881f600153ed98c06880965da62283a784 (patch)
treef75eb609a685d662bc59dfc14c01ff3800381e99
parent7f80e8a1a0c4e71fde9a1530cc49fd03da01c099 (diff)
downloadhollowdark-6e3be3881f600153ed98c06880965da62283a784.tar.xz
hollowdark-6e3be3881f600153ed98c06880965da62283a784.zip
Hold the initial-load progress bar to the first session entry and skip it on return
-rw-r--r--loading/lifecycle.ts15
-rw-r--r--routes/+page.svelte11
2 files changed, 24 insertions, 2 deletions
diff --git a/loading/lifecycle.ts b/loading/lifecycle.ts
new file mode 100644
index 0000000..ef9f2d8
--- /dev/null
+++ b/loading/lifecycle.ts
@@ -0,0 +1,15 @@
+let completed = false
+
+/**
+ * Whether the initial-load pipeline has finished during this browser
+ * session. Navigating away from the Begin screen and returning should
+ * not replay the progress bar — once it has run, it has run.
+ */
+export function hasCompletedInitialLoad(): boolean {
+ return completed
+}
+
+/** Record that the initial load has finished. Idempotent. */
+export function markInitialLoadComplete(): void {
+ completed = true
+}
diff --git a/routes/+page.svelte b/routes/+page.svelte
index c807b41..babf994 100644
--- a/routes/+page.svelte
+++ b/routes/+page.svelte
@@ -6,14 +6,21 @@
import InitialLoadScreen from '@hollowdark/lib/screens/InitialLoadScreen.svelte'
import { runStubInitialLoad } from '@hollowdark/loading/stub'
import { detectBeginState, type BeginState } from '@hollowdark/loading/session'
+ import {
+ hasCompletedInitialLoad,
+ markInitialLoadComplete
+ } from '@hollowdark/loading/lifecycle'
type View = 'loading' | 'begin'
- let view: View = $state('loading')
+ let view: View = $state(hasCompletedInitialLoad() ? 'begin' : 'loading')
let beginState: BeginState = $state({ kind: 'first-ever' })
onMount(async () => {
- await runStubInitialLoad()
+ if (!hasCompletedInitialLoad()) {
+ await runStubInitialLoad()
+ markInitialLoadComplete()
+ }
beginState = await detectBeginState()
view = 'begin'
})