diff --git a/app/w/[id]/components/workflow-block/components/sub-block/components/dropdown.tsx b/app/w/[id]/components/workflow-block/components/sub-block/components/dropdown.tsx index b3fdc352cc..10bb122da2 100644 --- a/app/w/[id]/components/workflow-block/components/sub-block/components/dropdown.tsx +++ b/app/w/[id]/components/workflow-block/components/sub-block/components/dropdown.tsx @@ -9,7 +9,7 @@ import { import { useSubBlockValue } from '../hooks/use-sub-block-value' interface DropdownProps { - options: string[] + options: Array defaultValue?: string blockId: string subBlockId: string @@ -21,14 +21,24 @@ export function Dropdown({ options, defaultValue, blockId, subBlockId }: Dropdow // Set the value to the first option if it's not set useEffect(() => { if (!value && options.length > 0) { - setValue(defaultValue ?? options[0]) + const firstOption = options[0] + const firstValue = typeof firstOption === 'string' ? firstOption : firstOption.id + setValue(firstValue) } }, [value, options, defaultValue, setValue]) + const getOptionValue = (option: string | { label: string; id: string }) => { + return typeof option === 'string' ? option : option.id + } + + const getOptionLabel = (option: string | { label: string; id: string }) => { + return typeof option === 'string' ? option : option.label + } + return (