Skip to content

Commit 70dd04d

Browse files
committed
fix: enable workflow validation in panel
1 parent 1376793 commit 70dd04d

File tree

1 file changed

+9
-1
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel

1 file changed

+9
-1
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
} from '@/components/emcn'
2727
import { VariableIcon } from '@/components/icons'
2828
import { generateWorkflowJson } from '@/lib/workflows/operations/import-export'
29+
import { validateWorkflowState } from '@/lib/workflows/sanitization/validation'
2930
import { useRegisterGlobalCommands } from '@/app/workspace/[workspaceId]/providers/global-commands-provider'
3031
import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider'
3132
import { createCommands } from '@/app/workspace/[workspaceId]/utils/commands-utils'
@@ -356,7 +357,14 @@ export const Panel = memo(function Panel() {
356357
// Compute run button state
357358
const canRun = userPermissions.canRead // Running only requires read permissions
358359
const isLoadingPermissions = userPermissions.isLoading
359-
const hasValidationErrors = false // TODO: Add validation logic if needed
360+
const hasValidationErrors = useWorkflowStore((state) => {
361+
if (Object.keys(state.blocks).length === 0) return false
362+
const result = validateWorkflowState({
363+
blocks: state.blocks,
364+
edges: state.edges,
365+
})
366+
return !result.valid
367+
})
360368
const isWorkflowBlocked = isExecuting || hasValidationErrors
361369
const isButtonDisabled = !isExecuting && (isWorkflowBlocked || (!canRun && !isLoadingPermissions))
362370

0 commit comments

Comments
 (0)