From bce1cb7b077a1438ae1cf16173150469f3896ae5 Mon Sep 17 00:00:00 2001 From: James Long Date: Mon, 4 May 2026 15:32:24 -0400 Subject: [PATCH] ui cleanup --- .../cli/cmd/tui/component/prompt/index.tsx | 9 +++----- .../opencode/src/cli/cmd/tui/routes/home.tsx | 21 ------------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx index 8d8c9e1635..52b200d56b 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -50,8 +50,6 @@ import { WorkspaceLabel, type WorkspaceStatus } from "../workspace-label" export type PromptProps = { sessionID?: string workspaceID?: string - workspaceSelection?: WorkspaceSelection - onWorkspaceSelectionChange?: (selection: WorkspaceSelection | undefined) => void onWorkspaceCreatingChange?: (creating: boolean) => void visible?: boolean disabled?: boolean @@ -161,11 +159,9 @@ export function Prompt(props: PromptProps) { const [warpNotice, setWarpNotice] = createSignal() const currentProviderLabel = createMemo(() => local.model.parsed().provider) const hasRightContent = createMemo(() => Boolean(props.right)) - const selectedWorkspace = () => props.workspaceSelection ?? workspaceSelection() function selectWorkspace(selection: WorkspaceSelection | undefined) { setWorkspaceSelection(selection) - props.onWorkspaceSelectionChange?.(selection) } function setCreatingWorkspace(creating: boolean) { @@ -782,6 +778,7 @@ export function Prompt(props: PromptProps) { async function submit() { setWarpNotice(undefined) + // IME: double-defer may fire before onContentChange flushes the last // composed character (e.g. Korean hangul) to the store, so read // plainText directly and sync before any downstream reads. @@ -891,7 +888,7 @@ export function Prompt(props: PromptProps) { let sessionID = props.sessionID if (sessionID == null) { - const workspace = selectedWorkspace() + const workspace = workspaceSelection() const workspaceID = iife(() => { if (!workspace) return undefined if (workspace.type === "none") return undefined @@ -1125,7 +1122,7 @@ export function Prompt(props: PromptProps) { | { type: "existing"; workspaceType: string; workspaceName: string; status?: WorkspaceStatus } | undefined >(() => { - const selected = selectedWorkspace() + const selected = workspaceSelection() if (!selected) return if (selected.type === "none") return if (props.sessionID && !workspaceCreating()) return diff --git a/packages/opencode/src/cli/cmd/tui/routes/home.tsx b/packages/opencode/src/cli/cmd/tui/routes/home.tsx index 1204d2d684..4c1cd1babd 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/home.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/home.tsx @@ -9,7 +9,6 @@ import { useRouteData } from "@tui/context/route" import { usePromptRef } from "../context/prompt" import { useLocal } from "../context/local" import { TuiPluginRuntime } from "@/cli/cmd/tui/plugin/runtime" -import type { WorkspaceSelection } from "../component/dialog-workspace-create" let once = false const placeholder = { @@ -23,28 +22,10 @@ export function Home() { const route = useRouteData("home") const promptRef = usePromptRef() const [ref, setRef] = createSignal() - const [workspaceSelection, setWorkspaceSelection] = createSignal() const args = useArgs() const local = useLocal() let sent = false - const currentWorkspaceSelection = (): WorkspaceSelection | undefined => { - const workspaceID = project.workspace.current() - if (!workspaceID) return { type: "none" } - const workspace = project.workspace.get(workspaceID) - return { - type: "existing", - workspaceID, - workspaceType: workspace?.type ?? "unknown", - workspaceName: workspace?.name ?? workspaceID, - } - } - - createEffect(() => { - if (workspaceSelection()) return - setWorkspaceSelection(currentWorkspaceSelection()) - }) - const bind = (r: PromptRef | undefined) => { setRef(r) promptRef.set(r) @@ -92,8 +73,6 @@ export function Home() { } placeholders={placeholder} />