From a8de5b2b9bec07a5ed5df54b859fa6ff5f98406f Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Sun, 21 Jun 2026 22:54:00 +0900 Subject: 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. --- src/app/store.svelte.ts | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'src/app') 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 | 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 = { -- cgit v1.2.3