diff --git a/app/w/components/workflow-block/components/sub-block/components/dropdown.tsx b/app/w/components/workflow-block/components/sub-block/components/dropdown.tsx index 8203251fa0..b31d8c4344 100644 --- a/app/w/components/workflow-block/components/sub-block/components/dropdown.tsx +++ b/app/w/components/workflow-block/components/sub-block/components/dropdown.tsx @@ -6,6 +6,7 @@ import { SelectValue, } from '@/components/ui/select' import { useSubBlockValue } from '../hooks/use-sub-block-value' +import { useEffect } from 'react' interface DropdownProps { options: string[] @@ -22,12 +23,20 @@ export function Dropdown({ }: DropdownProps) { const [value, setValue] = useSubBlockValue(blockId, subBlockId) + // Set the value to the first option if it's not set + useEffect(() => { + if (!value && options.length > 0) { + setValue(defaultValue ?? options[0]) + } + }, [value, options, defaultValue, setValue]) + return (