Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Christdej committed Nov 1, 2023
1 parent b2e3b2e commit 29dd806
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/Contexts/MissionListsContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const useMissions = (refreshInterval: number): MissionsResult => {
const id = setInterval(fetchAndUpdateMissions, refreshInterval)

return () => clearInterval(id)
}, [refreshInterval, BackendAPICaller.accessToken])
}, [refreshInterval])

return { ongoingMissions, missionQueue }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const StopMissionDialog = ({ mission }: MissionProps): JSX.Element => {

useEffect(() => {
if (missionId !== mission.id) setIsStopMissionDialogOpen(false)
}, [mission.id])
}, [mission.id, missionId])

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function InspectionSection({
updateScheduledMissionsMap(deckMissions)
}, refreshInterval)
return () => clearInterval(id)
}, [deckMissions])
}, [deckMissions, refreshInterval])

return (
<>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Pages/RobotPage/AreaMapView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CircularProgress, Typography } from '@equinor/eds-core-react'
import { MouseEvent, useEffect, useState } from 'react'
import { MouseEvent, useCallback, useEffect, useState } from 'react'
import styled from 'styled-components'
import NoMap from 'mediaAssets/NoMap.png'
import { PlaceRobotInMap, InverseCalculatePixelPosition } from '../../../utils/MapMarkers'
Expand Down Expand Up @@ -52,7 +52,7 @@ export function AreaMapView({ area, localizationPose, setLocalizationPose }: Are
const [imageObjectURL, setImageObjectURL] = useState<string>()
const [isLoading, setIsLoading] = useState<boolean>()

const updateMap = () => {
const updateMap = useCallback(() => {
let context = mapCanvas.getContext('2d')
if (context === null) {
return
Expand All @@ -62,7 +62,7 @@ export function AreaMapView({ area, localizationPose, setLocalizationPose }: Are
if (mapMetadata) {
PlaceRobotInMap(mapMetadata, mapCanvas, localizationPose)
}
}
}, [mapCanvas, mapImage, mapMetadata, localizationPose])

const getMeta = async (url: string) => {
const image = new Image()
Expand Down
21 changes: 11 additions & 10 deletions frontend/src/components/Pages/RobotPage/RobotPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Typography } from '@equinor/eds-core-react'
import { BackendAPICaller } from 'api/ApiCaller'
import { Robot } from 'models/Robot'
import { useEffect, useState } from 'react'
import { useCallback, useEffect, useState } from 'react'
import { useParams } from 'react-router-dom'
import styled from 'styled-components'
import { BackButton } from '../../../utils/BackButton'
Expand Down Expand Up @@ -50,24 +50,25 @@ export function RobotPage() {
const { robotId } = useParams()
const [selectedRobot, setSelectedRobot] = useState<Robot>()

const fetchRobotData = useCallback(() => {
if (robotId) {
BackendAPICaller.getRobotById(robotId).then((robot) => {
setSelectedRobot(robot)
})
}
}, [robotId])

useEffect(() => {
fetchRobotData()
}, [robotId])
}, [fetchRobotData])

useEffect(() => {
const intervalId = setInterval(fetchRobotData, updateSiteTimer)
return () => {
clearInterval(intervalId)
}
}, [])
}, [fetchRobotData])

const fetchRobotData = () => {
if (robotId) {
BackendAPICaller.getRobotById(robotId).then((robot) => {
setSelectedRobot(robot)
})
}
}
return (
<>
<Header page={'robot'} />
Expand Down

0 comments on commit 29dd806

Please sign in to comment.