From df27bc1898ea7c5422d72866e5e597299da64d22 Mon Sep 17 00:00:00 2001 From: Arjun <6592213+arkml@users.noreply.github.com> Date: Tue, 17 Feb 2026 17:49:50 +0530 Subject: [PATCH] fix new chat --- apps/x/apps/renderer/src/App.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/x/apps/renderer/src/App.tsx b/apps/x/apps/renderer/src/App.tsx index 30ac9032..f7f328b8 100644 --- a/apps/x/apps/renderer/src/App.tsx +++ b/apps/x/apps/renderer/src/App.tsx @@ -1740,9 +1740,14 @@ function App() { }, [activeFileTabId]) const handleNewChatTab = useCallback(() => { - // If current chat tab already has a run, open a new tab - const activeTab = chatTabs.find(t => t.id === activeChatTabId) - if (activeTab?.runId) { + // If there's already an empty "New chat" tab, switch to it + const emptyTab = chatTabs.find(t => !t.runId) + if (emptyTab) { + if (emptyTab.id !== activeChatTabId) { + setActiveChatTabId(emptyTab.id) + } + } else { + // Create a new tab const id = newChatTabId() setChatTabs(prev => [...prev, { id, runId: null }]) setActiveChatTabId(id)