From e0f1c3c20efb60f19f36e2c8df87dfd30fd2523e Mon Sep 17 00:00:00 2001
From: Brendan Allan <git@brendonovich.dev>
Date: Fri, 13 Feb 2026 10:15:36 +0800
Subject: cleanup desktop loading page

---
 packages/desktop/src/loading.tsx | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

(limited to 'packages/desktop/src/loading.tsx')

diff --git a/packages/desktop/src/loading.tsx b/packages/desktop/src/loading.tsx
index ee2982722..23a8055c9 100644
--- a/packages/desktop/src/loading.tsx
+++ b/packages/desktop/src/loading.tsx
@@ -5,7 +5,7 @@ import { Font } from "@opencode-ai/ui/font"
 import { Splash } from "@opencode-ai/ui/logo"
 import { Progress } from "@opencode-ai/ui/progress"
 import "./styles.css"
-import { createEffect, createMemo, createSignal, onCleanup } from "solid-js"
+import { createEffect, createMemo, createSignal, onCleanup, onMount } from "solid-js"
 import { commands, events, InitStep } from "./bindings"
 import { Channel } from "@tauri-apps/api/core"
 
@@ -29,36 +29,20 @@ render(() => {
   channel.onmessage = (next) => setStep(next)
   commands.awaitInitialization(channel as any).catch(() => undefined)
 
-  createEffect(() => {
-    if (phase() !== "sqlite_waiting") return
-
+  onMount(() => {
     setLine(0)
     setPercent(0)
 
     const timers = delays.map((ms, i) => setTimeout(() => setLine(i + 1), ms))
 
-    let stop: (() => void) | undefined
-    let active = true
-
-    void events.sqliteMigrationProgress
-      .listen((e) => {
-        if (e.payload.type === "InProgress") setPercent(Math.max(0, Math.min(100, e.payload.value)))
-        if (e.payload.type === "Done") setPercent(100)
-      })
-      .then((unlisten) => {
-        if (active) {
-          stop = unlisten
-          return
-        }
-
-        unlisten()
-      })
-      .catch(() => undefined)
+    const listener = events.sqliteMigrationProgress.listen((e) => {
+      if (e.payload.type === "InProgress") setPercent(Math.max(0, Math.min(100, e.payload.value)))
+      if (e.payload.type === "Done") setPercent(100)
+    })
 
     onCleanup(() => {
-      active = false
+      listener.then((cb) => cb())
       timers.forEach(clearTimeout)
-      stop?.()
     })
   })
 
-- 
cgit v1.2.3

