Skip to content

Commit

Permalink
Fix warning in localizationDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
mrica-equinor committed Aug 10, 2023
1 parent 80ded50 commit f7806ca
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ export const LocalizationDialog = ({ robot }: RobotProps): JSX.Element => {
})
}, [])

useEffect(() => {
if (selectedArea && localizationPose && localizing) {
const localizeRobot = () => {
if (selectedArea && localizationPose) {
onLocalizationDialogClose()
BackendAPICaller.postLocalizationMission(localizationPose, robot.id, selectedArea.id)
.then((result: unknown) => result as Mission)
.then(async (mission: Mission) => {
Expand All @@ -90,9 +91,8 @@ export const LocalizationDialog = ({ robot }: RobotProps): JSX.Element => {
.catch((e) => {
console.error(e)
})
onLocalizationDialogClose()
}
}, [localizing])
}

const getAreaNames = (areas: Area[]): Map<string, Area> => {
var areaNameMap = new Map<string, Area>()
Expand Down Expand Up @@ -133,6 +133,7 @@ export const LocalizationDialog = ({ robot }: RobotProps): JSX.Element => {
const onClickLocalize = async () => {
setMissionLocalizationInfo(undefined)
setLocalizing(true)
localizeRobot()
}

const areaNames = areas ? Array.from(getAreaNames(areas).keys()).sort() : []
Expand Down

0 comments on commit f7806ca

Please sign in to comment.