diff --git a/src/components/ChatBox/TaskCard.tsx b/src/components/ChatBox/TaskCard.tsx index 03a85f8a..c25d15f3 100644 --- a/src/components/ChatBox/TaskCard.tsx +++ b/src/components/ChatBox/TaskCard.tsx @@ -333,14 +333,15 @@ export function TaskCard({ if (task.agent) { // Switch to the chatStore that owns this task card (for multi-turn conversations) if (chatId && projectStore.activeProjectId) { + const activeProjectId = projectStore.activeProjectId; const activeChatStore = projectStore.getActiveChatStore(); - const currentChatId = activeChatStore ? Object.keys(projectStore.projects[projectStore.activeProjectId].chatStores).find( - id => projectStore.projects[projectStore.activeProjectId].chatStores[id] === activeChatStore + const currentChatId = activeChatStore ? Object.keys(projectStore.projects[activeProjectId].chatStores).find( + id => projectStore.projects[activeProjectId].chatStores[id] === activeChatStore ) : null; - + // Only switch if this is a different chat if (currentChatId !== chatId) { - projectStore.setActiveChatStore(projectStore.activeProjectId, chatId); + projectStore.setActiveChatStore(activeProjectId, chatId); } } diff --git a/src/pages/Dashboard/Browser.tsx b/src/pages/Dashboard/Browser.tsx index 4b83f0c7..37101c25 100644 --- a/src/pages/Dashboard/Browser.tsx +++ b/src/pages/Dashboard/Browser.tsx @@ -272,7 +272,7 @@ export default function Browser() { {cookieDomains.length > 0 && (