diff options
| author | Adam Malczewski <[email protected]> | 2026-08-05 14:46:21 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-08-05 14:46:21 +0900 |
| commit | 774519e052fd869952cc5e05aca159e4bf978fa1 (patch) | |
| tree | 2af954316135be8ef689271a807a9bad500ca985 /src/features/tabs/tabs.ts | |
| parent | 42cada78db1e58947074f12dcf7c8e41fc501b40 (diff) | |
| download | dispatch-web-774519e052fd869952cc5e05aca159e4bf978fa1.tar.gz dispatch-web-774519e052fd869952cc5e05aca159e4bf978fa1.zip | |
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.
Diffstat (limited to 'src/features/tabs/tabs.ts')
| -rw-r--r-- | src/features/tabs/tabs.ts | 11 |
1 files changed, 11 insertions, 0 deletions
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; |
