diff options
| author | Adam Malczewski <[email protected]> | 2026-06-22 16:09:56 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-22 16:09:56 +0900 |
| commit | 2a7708bd492a5a78794c76ee43355cabe786943e (patch) | |
| tree | b285acdda11231fb3b25e6fceb32af268dfa8a29 /src/app | |
| parent | 1df0831551a06496294ea40f9001bf3a86f1bc09 (diff) | |
| download | dispatch-web-2a7708bd492a5a78794c76ee43355cabe786943e.tar.gz dispatch-web-2a7708bd492a5a78794c76ee43355cabe786943e.zip | |
feat: double-click tab to rename (PUT /conversations/:id/title)
Double-click a tab's title to enter inline edit mode. Enter or click
away (blur) saves; Escape cancels. The rename is optimistic — the
local tab updates immediately and PUT /title fires in the background.
683 tests green.
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/App.svelte | 1 | ||||
| -rw-r--r-- | src/app/store.svelte.ts | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/app/App.svelte b/src/app/App.svelte index ae09bd5..9225cc7 100644 --- a/src/app/App.svelte +++ b/src/app/App.svelte @@ -309,6 +309,7 @@ onSelect={(id) => store.selectTab(id)} onClose={(id) => store.closeTab(id)} onNewDraft={() => store.newDraft()} + onRename={(id, title) => store.renameTab(id, title)} /> <span class="shrink-0 select-none px-1 font-mono text-[10px] leading-none text-base-content/30" diff --git a/src/app/store.svelte.ts b/src/app/store.svelte.ts index 3f78a97..6cff5f8 100644 --- a/src/app/store.svelte.ts +++ b/src/app/store.svelte.ts @@ -18,6 +18,7 @@ import type { SetCompactPercentRequest, SetCwdRequest, SetReasoningEffortRequest, + SetTitleRequest, WarmRequest, WarmResponse, } from "@dispatch/transport-contract"; @@ -114,6 +115,7 @@ export interface AppStore { newDraft(): void; selectTab(conversationId: string): void; closeTab(conversationId: string): void; + renameTab(conversationId: string, title: string): void; invoke(surfaceId: string, actionId: string, payload?: unknown): void; /** * Manually warm the focused conversation's prompt cache (`POST /chat/warm`). @@ -869,6 +871,17 @@ export function createAppStore(opts?: CreateAppStoreOptions): AppStore { removeTabLocally(conversationId); }, + renameTab(conversationId: string, title: string): void { + tabsStore.setTitle(conversationId, title); + void fetchImpl(`${httpBase}/conversations/${encodeURIComponent(conversationId)}/title`, { + method: "PUT", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ title } satisfies SetTitleRequest), + }).catch(() => { + // Best-effort — the local tab is already renamed. + }); + }, + invoke(surfaceId: string, actionId: string, payload?: unknown): void { const result = protocolInvoke( protocol, |
