diff options
| author | Adam Malczewski <[email protected]> | 2026-06-21 22:54:00 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-21 22:54:00 +0900 |
| commit | a8de5b2b9bec07a5ed5df54b859fa6ff5f98406f (patch) | |
| tree | 54ffa30ec7b6fcef6d95f0da914381316d0d62c8 /src/app | |
| parent | 6c61fb52494b5a11f96b7ec814b625d61a67399c (diff) | |
| download | dispatch-web-a8de5b2b9bec07a5ed5df54b859fa6ff5f98406f.tar.gz dispatch-web-a8de5b2b9bec07a5ed5df54b859fa6ff5f98406f.zip | |
fix: conversation.open opens tab without auto-switching
CLI --open should add the tab to the strip but leave the user on their
current tab. Add openTab reducer (add without selecting) + use it in
openConversation instead of createTab+selectTab.
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/store.svelte.ts | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/src/app/store.svelte.ts b/src/app/store.svelte.ts index 5159353..5a5245d 100644 --- a/src/app/store.svelte.ts +++ b/src/app/store.svelte.ts @@ -434,29 +434,23 @@ export function createAppStore(opts?: CreateAppStoreOptions): AppStore { let socket: ReturnType<typeof createSurfaceSocket> | null = null; /** - * Open (or focus) a conversation tab — used by the `conversation.open` WS - * broadcast (CLI `--open` flag). If the conversation is already open, just - * focus it; otherwise create a chat store, load its history, subscribe to its - * live turns, and create+select the tab. + * Open a conversation tab — used by the `conversation.open` WS broadcast + * (CLI `--open` flag). If the conversation is already open, this is a no-op; + * otherwise create a chat store, load its history, subscribe to its live + * turns, and add the tab WITHOUT switching the active conversation (the user + * stays on their current tab; the new tab appears in the strip). */ function openConversation(conversationId: string): void { - const alreadyOpen = chatStores.has(conversationId); - if (!alreadyOpen) { - const store = createChatFor(conversationId, activeModel); - chatStores.set(conversationId, store); - void store.load(); - subscribeChat(conversationId); - tabsStore.createTab({ - conversationId, - model: activeModel, - title: "Conversation", - }); - } - tabsStore.selectTab(conversationId); - refreshActiveChat(); - syncSubscriptions(); - void refreshCwd(); - void refreshReasoningEffort(); + if (chatStores.has(conversationId)) return; + const store = createChatFor(conversationId, activeModel); + chatStores.set(conversationId, store); + void store.load(); + subscribeChat(conversationId); + tabsStore.openTab({ + conversationId, + model: activeModel, + title: "Conversation", + }); } const socketOpts: SurfaceSocketOptions = { |
