improve startup speed

This commit is contained in:
Dax Raad
2025-11-08 20:17:46 -05:00
parent 7af3380455
commit 4bb7ea9127
15 changed files with 203 additions and 192 deletions

View File

@@ -1,5 +1,5 @@
import { Prompt } from "@tui/component/prompt"
import { createMemo, Match, Show, Switch, type ParentProps } from "solid-js"
import { Prompt, type PromptRef } from "@tui/component/prompt"
import { createMemo, Match, onMount, Show, Switch, type ParentProps } from "solid-js"
import { useTheme } from "@tui/context/theme"
import { useKeybind } from "../context/keybind"
import type { KeybindsConfig } from "@opencode-ai/sdk"
@@ -7,6 +7,10 @@ import { Logo } from "../component/logo"
import { Locale } from "@/util/locale"
import { useSync } from "../context/sync"
import { Toast } from "../ui/toast"
import { useArgs } from "../context/args"
// TODO: what is the best way to do this?
let once = false
export function Home() {
const sync = useSync()
@@ -38,6 +42,16 @@ export function Home() {
</Show>
)
let prompt: PromptRef
const args = useArgs()
onMount(() => {
if (once) return
if (args.prompt) {
prompt.set({ input: args.prompt, parts: [] })
once = true
}
})
return (
<box
flexGrow={1}
@@ -55,7 +69,7 @@ export function Home() {
<HelpRow keybind="agent_cycle">Switch agent</HelpRow>
</box>
<box width="100%" maxWidth={75} zIndex={1000} paddingTop={1}>
<Prompt hint={Hint} />
<Prompt ref={(r) => (prompt = r)} hint={Hint} />
</box>
<Toast />
</box>