diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx index 22aab4c9251..1f21304b5ce 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx @@ -210,7 +210,7 @@ function WorkflowToolDeployBadge({ workflowId: string onDeploySuccess?: () => void }) { - const { data, isLoading } = useDeploymentInfo(workflowId) + const { data, isLoading } = useDeploymentInfo(workflowId, { refetchOnMount: 'always' }) const { mutate, isPending: isDeploying } = useDeployWorkflow() const userPermissions = useUserPermissionsContext() @@ -1021,13 +1021,13 @@ export const ToolInput = memo(function ToolInput({ [isPreview, disabled, selectedTools, setStoreValue] ) - const [previewExpanded, setPreviewExpanded] = useState>({}) + const [localExpanded, setLocalExpanded] = useState>({}) const toggleToolExpansion = (toolIndex: number) => { - if ((isPreview && !allowExpandInPreview) || disabled) return + if (isPreview && !allowExpandInPreview) return - if (isPreview) { - setPreviewExpanded((prev) => ({ + if (isPreview || disabled) { + setLocalExpanded((prev) => ({ ...prev, [toolIndex]: !(prev[toolIndex] ?? !!selectedTools[toolIndex]?.isExpanded), })) @@ -1689,8 +1689,8 @@ export const ToolInput = memo(function ToolInput({ const hasToolBody = hasOperations || hasParams const isExpandedForDisplay = hasToolBody - ? isPreview - ? (previewExpanded[toolIndex] ?? !!tool.isExpanded) + ? isPreview || disabled + ? (localExpanded[toolIndex] ?? !!tool.isExpanded) : !!tool.isExpanded : false diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/hooks/use-child-workflow.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/hooks/use-child-workflow.ts index f13b80ec210..78b4126c8da 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/hooks/use-child-workflow.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/hooks/use-child-workflow.ts @@ -11,8 +11,9 @@ export interface UseChildWorkflowReturn { /** * Manages child workflow deployment status for workflow selector blocks. - * Uses the shared useDeploymentInfo query (same source of truth as the - * editor header's Deploy button) for consistent deployment detection. + * Uses useDeploymentInfo which computes needsRedeployment server-side via + * hasWorkflowChanged — the same comparison the deploy button uses — so the + * badge stays aligned with the child workflow's Live/Update header. */ export function useChildWorkflow( blockId: string, @@ -39,7 +40,8 @@ export function useChildWorkflow( } const { data, isPending } = useDeploymentInfo( - isWorkflowSelector ? (childWorkflowId ?? null) : null + isWorkflowSelector ? (childWorkflowId ?? null) : null, + { refetchOnMount: 'always' } ) const childIsDeployed = data?.isDeployed ?? null diff --git a/apps/sim/hooks/queries/deployments.ts b/apps/sim/hooks/queries/deployments.ts index 7bcf8be904d..a0a559ce802 100644 --- a/apps/sim/hooks/queries/deployments.ts +++ b/apps/sim/hooks/queries/deployments.ts @@ -83,13 +83,17 @@ async function fetchDeploymentInfo( * Hook to fetch deployment info for a workflow. * Provides isDeployed status, deployedAt timestamp, apiKey info, and needsRedeployment flag. */ -export function useDeploymentInfo(workflowId: string | null, options?: { enabled?: boolean }) { +export function useDeploymentInfo( + workflowId: string | null, + options?: { enabled?: boolean; refetchOnMount?: boolean | 'always' } +) { return useQuery({ queryKey: deploymentKeys.info(workflowId), queryFn: ({ signal }) => fetchDeploymentInfo(workflowId!, signal), enabled: Boolean(workflowId) && (options?.enabled ?? true), staleTime: 30 * 1000, // 30 seconds placeholderData: keepPreviousData, + ...(options?.refetchOnMount !== undefined && { refetchOnMount: options.refetchOnMount }), }) }