Skip to content

Commit

Permalink
Fix non-null-asserted-optional-chain error
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddasol committed Dec 19, 2024
1 parent 2e8ab32 commit 3db49b5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ export const ScheduleMissionWithLocalizationVerificationDialog = ({
{dialogToOpen === DialogTypes.conflictingMissionDecks && (
<ConflictingMissionDecksDialog closeDialog={closeDialog} missionDeckNames={unikMissionDeckNames!} />
)}
{dialogToOpen === DialogTypes.conflictingRobotDeck && (
{dialogToOpen === DialogTypes.conflictingRobotDeck && selectedRobot?.currentInspectionArea?.deckName && (
<ConflictingRobotDeckDialog
closeDialog={closeDialog}
robotDeckName={selectedRobot?.currentInspectionArea?.deckName!}
robotDeckName={selectedRobot?.currentInspectionArea?.deckName}
desiredDeckName={unikMissionDeckNames![0]}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,33 @@ export const MissionMapView = ({ mission }: MissionProps) => {
displayedMapName = displayedMapName ? displayedMapName.charAt(0).toUpperCase() + displayedMapName.slice(1) : ' '

useEffect(() => {
BackendAPICaller.getMap(mission.installationCode!, mission.map?.mapName!)
.then((imageBlob) => {
imageObjectURL.current = URL.createObjectURL(imageBlob)
})
.catch(() => {
imageObjectURL.current = NoMap
})
.then(() => {
getMeta(imageObjectURL.current).then((img) => {
const mapCanvas = document.getElementById('mapCanvas') as HTMLCanvasElement
if (mapCanvas) {
mapCanvas.width = img.width
mapCanvas.height = img.height
const context = mapCanvas?.getContext('2d')
if (context) {
setMapContext(context)
context.drawImage(img, 0, 0)
if (mission.map?.mapName) {
BackendAPICaller.getMap(mission.installationCode!, mission.map?.mapName)
.then((imageBlob) => {
imageObjectURL.current = URL.createObjectURL(imageBlob)
})
.catch(() => {
imageObjectURL.current = NoMap
})
.then(() => {
getMeta(imageObjectURL.current).then((img) => {
const mapCanvas = document.getElementById('mapCanvas') as HTMLCanvasElement
if (mapCanvas) {
mapCanvas.width = img.width
mapCanvas.height = img.height
const context = mapCanvas?.getContext('2d')
if (context) {
setMapContext(context)
context.drawImage(img, 0, 0)
}
setMapCanvas(mapCanvas)
}
setMapCanvas(mapCanvas)
}
setMapImage(img)
setMapImage(img)
})
})
})
} else {
imageObjectURL.current = NoMap
}
}, [mission.installationCode, mission.id, mission.map?.mapName])

useEffect(() => {
Expand Down

0 comments on commit 3db49b5

Please sign in to comment.