Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -1021,13 +1021,13 @@ export const ToolInput = memo(function ToolInput({
[isPreview, disabled, selectedTools, setStoreValue]
)

const [previewExpanded, setPreviewExpanded] = useState<Record<number, boolean>>({})
const [localExpanded, setLocalExpanded] = useState<Record<number, boolean>>({})

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),
}))
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion apps/sim/hooks/queries/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
})
}

Expand Down
Loading