diff --git a/app/components/map/layers/mobile/mobile-box-view.tsx b/app/components/map/layers/mobile/mobile-box-view.tsx index bce575415..f1929596a 100644 --- a/app/components/map/layers/mobile/mobile-box-view.tsx +++ b/app/components/map/layers/mobile/mobile-box-view.tsx @@ -100,11 +100,7 @@ function Legend({ onColorChange && onColorChange(minColor, maxColor) }, [minColor, maxColor, onColorChange]) - const sensorData = sensor.data! as unknown as { - value: String - location: { x: number; y: number; id: number } - createdAt: Date - }[] + const sensorData = Array.isArray(sensor.data) ? sensor.data : [] const minValue = Math.min(...sensorData.map((d) => Number(d.value))) const maxValue = Math.max(...sensorData.map((d) => Number(d.value))) diff --git a/app/routes/explore.$deviceId.tsx b/app/routes/explore.$deviceId.tsx index 5345d985d..a2e63a312 100644 --- a/app/routes/explore.$deviceId.tsx +++ b/app/routes/explore.$deviceId.tsx @@ -108,11 +108,17 @@ export default function DeviceId() { value={{ hoveredPoint, setHoveredPoint: setHoveredPointDebug }} > {/* If the box is mobile, iterate over selected sensors and show trajectory */} - {data.device?.exposure === 'mobile' && !isSensorView && ( - - )} + {data.device?.exposure === 'mobile' && + !isSensorView && + Array.isArray(data.device?.locations) && + data.device.locations.length > 0 && ( + ({ + time: String(location.time), + geometry: location.geometry, + }))} + /> + )}