Skip to content

Commit 052b3e2

Browse files
committed
fix MapContent when loc is null,null
1 parent 98fffef commit 052b3e2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

apps/client/src/Components/Molecules/DataLora/MapContent.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Icon, IconOptions, polygon } from "leaflet";
33
import { FC, useCallback, useEffect, useState } from "react";
44
import { Marker, Polyline, Popup, TileLayer, useMap } from "react-leaflet";
55

6-
// const DEFAULT_CENTER: [number, number] = [52, 5.1];
6+
const DEFAULT_CENTER: [number, number] = [52, 5.1];
77

88
const DEFAULT_BOUNDS = polygon([
99
[52, 4],
@@ -56,7 +56,10 @@ const MapContent: FC<Props> = ({ coords, activeMarkerTimestamp }) => {
5656

5757
const updateBoundsAndMarker = useCallback(() => {
5858
const firstDeviceCoords = coords?.[0] ?? [];
59-
if (firstDeviceCoords.length > 0) {
59+
if (
60+
firstDeviceCoords.length > 0 &&
61+
hasValidCoords(firstDeviceCoords[0])
62+
) {
6063
const newPoly = polygon(firstDeviceCoords.map(({ loc }) => loc));
6164
map.fitBounds(newPoly.getBounds());
6265
const last: TrackerItem[] = coords

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "homeremote",
3-
"version": "3.7.16",
3+
"version": "3.7.17",
44
"license": "MIT",
55
"scripts": {
66
"writeGitInfo": "ts-node --project ./tsconfig.node.json writeGitInfo.ts",

0 commit comments

Comments
 (0)