diff --git a/protocol-designer/src/molecules/DropdownStepFormField/index.tsx b/protocol-designer/src/molecules/DropdownStepFormField/index.tsx index 869d272ddde..39da4a74ca9 100644 --- a/protocol-designer/src/molecules/DropdownStepFormField/index.tsx +++ b/protocol-designer/src/molecules/DropdownStepFormField/index.tsx @@ -1,4 +1,5 @@ import { useTranslation } from 'react-i18next' +import { useEffect } from 'react' import { COLORS, DIRECTION_COLUMN, @@ -36,9 +37,15 @@ export function DropdownStepFormField( const { t } = useTranslation('tooltip') const availableOptionId = options.find(opt => opt.value === value) + useEffect(() => { + if (options.length === 1) { + updateValue(options[0].value) + } + }, []) + return ( - {options.length > 1 ? ( + {options.length > 1 || options.length === 0 ? ( { - if (moduleLabwareOptions.length === 1) { - propsForFields.moduleId.updateValue(moduleLabwareOptions[0].value) - } - }, []) - const mappedErrorsToField = getFormErrorsMappedToField(visibleFormErrors) return ( - {moduleLabwareOptions.length > 1 ? ( - - ) : ( - - - {t('protocol_steps:module')} - - - - - {moduleLabwareOptions[0].name} - - - - - )} + { - if (moduleLabwareOptions.length === 1) { - propsForFields.moduleId.updateValue(moduleLabwareOptions[0].value) - } - }, []) - return ( - {moduleLabwareOptions.length > 1 ? ( - - ) : ( - - - {t('protocol_steps:module')} - - - - - {moduleLabwareOptions[0].name} - - - - - )} + {temperatureModuleIds != null ? temperatureModuleIds.map(id => @@ -73,7 +46,7 @@ export function TemperatureTools(props: StepFormProps): JSX.Element { ) => { + onChange={(e: ChangeEvent) => { propsForFields.setTemperature.updateValue( e.currentTarget.value ) @@ -96,7 +69,7 @@ export function TemperatureTools(props: StepFormProps): JSX.Element { ) => { + onChange={(e: ChangeEvent) => { propsForFields.setTemperature.updateValue( e.currentTarget.value )