Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Process all task streams all the time
  • Loading branch information
Theodore Li committed Mar 16, 2026
commit 170eb79b285985cce506375f66112a5d22488404
35 changes: 28 additions & 7 deletions apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { VFS_DIR_TO_RESOURCE } from '@/lib/copilot/resource-types'
import { isWorkflowToolName } from '@/lib/copilot/workflow-tools'
import { getNextWorkflowColor } from '@/lib/workflows/colors'
import { invalidateResourceQueries } from '@/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-registry'
import { deploymentKeys } from '@/hooks/queries/deployments'
import {
type TaskChatHistory,
type TaskStoredContentBlock,
Expand All @@ -21,6 +22,7 @@ import {
taskKeys,
useChatHistory,
} from '@/hooks/queries/tasks'
import { workflowKeys } from '@/hooks/queries/workflows'
import { getTopInsertionSortOrder } from '@/hooks/queries/utils/top-insertion-sort-order'
import { useExecutionStream } from '@/hooks/use-execution-stream'
import { useExecutionStore } from '@/stores/execution/store'
Expand Down Expand Up @@ -74,6 +76,8 @@ const STATE_TO_STATUS: Record<string, ToolCallStatus> = {
skipped: 'success',
} as const

const DEPLOY_TOOL_NAMES = new Set(['deploy_api', 'deploy_chat', 'deploy_mcp', 'redeploy'])

function mapStoredBlock(block: TaskStoredContentBlock): ContentBlock {
const mapped: ContentBlock = {
type: block.type as ContentBlockType,
Expand Down Expand Up @@ -287,13 +291,6 @@ export function useChat(
const executionStream = useExecutionStream()
const isHomePage = pathname.endsWith('/home')

useEffect(() => {
return () => {
abortControllerRef.current?.abort()
abortControllerRef.current = null
}
}, [])

const { data: chatHistory } = useChatHistory(initialChatId)

const addResource = useCallback((resource: MothershipResource): boolean => {
Expand Down Expand Up @@ -696,6 +693,30 @@ export function useChat(
onResourceEventRef.current?.()
}
}

if (DEPLOY_TOOL_NAMES.has(tc.name) && tc.status === 'success') {
const output = tc.result?.output as Record<string, unknown> | undefined
const deployedWorkflowId = (output?.workflowId as string) ?? undefined
if (deployedWorkflowId) {
const isDeployed = output?.isDeployed !== false
useWorkflowRegistry
.getState()
.setDeploymentStatus(
deployedWorkflowId,
isDeployed,
isDeployed ? new Date() : undefined
)
queryClient.invalidateQueries({
queryKey: deploymentKeys.info(deployedWorkflowId),
})
queryClient.invalidateQueries({
queryKey: deploymentKeys.versions(deployedWorkflowId),
})
queryClient.invalidateQueries({
queryKey: workflowKeys.list(workspaceId),
})
}
}
}

break
Expand Down