From 774519e052fd869952cc5e05aca159e4bf978fa1 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Wed, 5 Aug 2026 14:46:21 +0900 Subject: fix(tabs): reconcile tab workspaceId from authoritative backend data A summoned conversation's tab can be stamped with the wrong workspace ('default') because the raced conversation.open message precedes the child's workspace persistence. Add setWorkspaceId to the tabs store and reconcile an already-open tab's workspace from authoritative sources: the backend conversation-list refresh and lifecycle status events. This corrects a stale tab (incl. one persisted to localStorage) once the DB has the right value. --- src/features/tabs/tabs.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/features/tabs/tabs.ts') diff --git a/src/features/tabs/tabs.ts b/src/features/tabs/tabs.ts index 63cda35..9fc9306 100644 --- a/src/features/tabs/tabs.ts +++ b/src/features/tabs/tabs.ts @@ -82,6 +82,17 @@ export function setTitle(state: TabsState, conversationId: string, title: string return { tabs, activeConversationId: state.activeConversationId }; } +export function setWorkspaceId( + state: TabsState, + conversationId: string, + workspaceId: string, +): TabsState { + const tabs = state.tabs.map((t) => + t.conversationId === conversationId ? { ...t, workspaceId } : t, + ); + return { tabs, activeConversationId: state.activeConversationId }; +} + export function activeTab(state: TabsState): Tab | null { if (state.activeConversationId === null) return null; return state.tabs.find((t) => t.conversationId === state.activeConversationId) ?? null; -- cgit v1.2.3