diff --git a/frontend/src/components/Pages/InspectionPage/ScheduleMissionDialogs.tsx b/frontend/src/components/Pages/InspectionPage/ScheduleMissionDialogs.tsx index ba27fc2b8..b7cf56fe1 100644 --- a/frontend/src/components/Pages/InspectionPage/ScheduleMissionDialogs.tsx +++ b/frontend/src/components/Pages/InspectionPage/ScheduleMissionDialogs.tsx @@ -56,7 +56,6 @@ export const ScheduleMissionDialog = (props: IProps): JSX.Element => { const { setLoadingRobotMissionSet } = useMissionsContext() const { setAlert, setListAlert } = useAlertContext() const [isLocalizationVerificationDialogOpen, setIsLocalizationVerificationDialog] = useState(false) - const [selectedRobot, setSelectedRobot] = useState() const [missionsToSchedule, setMissionsToSchedule] = useState() const filteredRobots = enabledRobots.filter( (r) => @@ -65,6 +64,9 @@ export const ScheduleMissionDialog = (props: IProps): JSX.Element => { r.status === RobotStatus.Recharging) && r.isarConnected ) + const [selectedRobot, setSelectedRobot] = useState( + filteredRobots.length === 1 ? filteredRobots[0] : undefined + ) const onSelectedRobot = (selectedRobot: Robot) => { if (filteredRobots) setSelectedRobot(selectedRobot) @@ -152,7 +154,7 @@ export const ScheduleMissionDialog = (props: IProps): JSX.Element => { )} r.name + ' (' + r.model.type + ')'} options={filteredRobots}