cleanup desktop loading page
This commit is contained in:
@@ -665,6 +665,8 @@ async fn initialize(app: AppHandle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let _ = server_ready_rx.await;
|
let _ = server_ready_rx.await;
|
||||||
|
|
||||||
|
tracing::info!("Loading task finished");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.map_err(|_| ())
|
.map_err(|_| ())
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Font } from "@opencode-ai/ui/font"
|
|||||||
import { Splash } from "@opencode-ai/ui/logo"
|
import { Splash } from "@opencode-ai/ui/logo"
|
||||||
import { Progress } from "@opencode-ai/ui/progress"
|
import { Progress } from "@opencode-ai/ui/progress"
|
||||||
import "./styles.css"
|
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 { commands, events, InitStep } from "./bindings"
|
||||||
import { Channel } from "@tauri-apps/api/core"
|
import { Channel } from "@tauri-apps/api/core"
|
||||||
|
|
||||||
@@ -29,36 +29,20 @@ render(() => {
|
|||||||
channel.onmessage = (next) => setStep(next)
|
channel.onmessage = (next) => setStep(next)
|
||||||
commands.awaitInitialization(channel as any).catch(() => undefined)
|
commands.awaitInitialization(channel as any).catch(() => undefined)
|
||||||
|
|
||||||
createEffect(() => {
|
onMount(() => {
|
||||||
if (phase() !== "sqlite_waiting") return
|
|
||||||
|
|
||||||
setLine(0)
|
setLine(0)
|
||||||
setPercent(0)
|
setPercent(0)
|
||||||
|
|
||||||
const timers = delays.map((ms, i) => setTimeout(() => setLine(i + 1), ms))
|
const timers = delays.map((ms, i) => setTimeout(() => setLine(i + 1), ms))
|
||||||
|
|
||||||
let stop: (() => void) | undefined
|
const listener = events.sqliteMigrationProgress.listen((e) => {
|
||||||
let active = true
|
if (e.payload.type === "InProgress") setPercent(Math.max(0, Math.min(100, e.payload.value)))
|
||||||
|
if (e.payload.type === "Done") setPercent(100)
|
||||||
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)
|
|
||||||
|
|
||||||
onCleanup(() => {
|
onCleanup(() => {
|
||||||
active = false
|
listener.then((cb) => cb())
|
||||||
timers.forEach(clearTimeout)
|
timers.forEach(clearTimeout)
|
||||||
stop?.()
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user