Skip to content

Commit 01831dd

Browse files
committed
fix(chat): project desktop tabs in organization Assistant chats
Organization Home passed projectsDesktopTabs: false to useChat in Assistant mode, which only nulls the native active-tab ids used for the strip's fallback. ChatResourcePanel still projects the chat scope's browser and terminal tabs in every mode, and chat link clicks in the desktop app open those tabs through the same projection, so Assistant chats showed desktop tabs while ignoring which one the desktop app remembers (the #7793 reopen behavior). Build Home's options with getMothershipUseChatOptions, like workspace Home, so tabs project consistently in every mode. Assistant requests still attach no resources.
1 parent 1fe12ef commit 01831dd

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

‎apps/sim/app/o/[organizationId]/home/organization-home.test.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ vi.mock('@/lib/core/utils/browser-storage', () => ({
6969
vi.mock('@/app/o/[organizationId]/providers/organization-provider', () => ({
7070
useOrganizationContext: mocks.context,
7171
}))
72-
vi.mock('@/app/workspace/[workspaceId]/home/hooks/use-chat', () => ({ useChat: mocks.chat }))
72+
vi.mock('@/app/workspace/[workspaceId]/home/hooks/use-chat', () => ({
73+
getMothershipUseChatOptions: (options: object) => ({ ...options, mothership: true }),
74+
useChat: mocks.chat,
75+
}))
7376
vi.mock('@/hooks/queries/mothership-chats', () => ({
7477
useMarkMothershipChatRead: () => ({ mutate: mocks.markRead }),
7578
}))
@@ -602,7 +605,7 @@ describe('Home permission-selected harness', () => {
602605
expect(mocks.chat).toHaveBeenLastCalledWith(
603606
{ organizationId: 'organization-a' },
604607
'search-a',
605-
expect.objectContaining({ requestMode: 'assistant', projectsDesktopTabs: false })
608+
expect.objectContaining({ requestMode: 'assistant', mothership: true })
606609
)
607610
})
608611
it('keeps old Build history readable after permission removal without a writable composer', async () => {

‎apps/sim/app/o/[organizationId]/home/organization-home.tsx‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ import { SearchIntegrationConnection } from '@/app/workspace/[workspaceId]/home/
2626
import { MothershipChat } from '@/app/workspace/[workspaceId]/home/components/mothership-chat'
2727
import { SuggestedActions } from '@/app/workspace/[workspaceId]/home/components/suggested-actions'
2828
import { HomeFallback } from '@/app/workspace/[workspaceId]/home/home-fallback'
29-
import { useChat } from '@/app/workspace/[workspaceId]/home/hooks/use-chat'
29+
import {
30+
getMothershipUseChatOptions,
31+
useChat,
32+
} from '@/app/workspace/[workspaceId]/home/hooks/use-chat'
3033
import {
3134
useChatResourcePanel,
3235
useResourcePanelController,
@@ -102,12 +105,15 @@ function OrganizationHomeContent({
102105
: 'agent')
103106
const controller = useResourcePanelController()
104107
const queryClient = useQueryClient()
105-
const chat = useChat({ organizationId: organization.id }, chatId, {
106-
requestMode,
107-
projectsDesktopTabs: requestMode !== 'assistant',
108-
onResourceEvent: controller.onResourceEvent,
109-
activeResourceState: controller.activeResourceState,
110-
})
108+
const chat = useChat(
109+
{ organizationId: organization.id },
110+
chatId,
111+
getMothershipUseChatOptions({
112+
requestMode,
113+
onResourceEvent: controller.onResourceEvent,
114+
activeResourceState: controller.activeResourceState,
115+
})
116+
)
111117
const initialDraftKey = `${userId}:organization:${organization.id}:${chatId ?? 'new'}`
112118
const draftKey = `${userId}:organization:${organization.id}:${chat.resolvedChatId ?? chatId ?? 'new'}`
113119
const savedDraft = useMothershipDraftsStore.getState().drafts

0 commit comments

Comments
 (0)