From 06df445010786bf0c51f38a6d39f7a8ed4d027b7 Mon Sep 17 00:00:00 2001 From: Roberto Milla Martinez Date: Thu, 7 Nov 2024 16:16:20 +0100 Subject: [PATCH] fix: on new permissions trigger geolocation --- src/components/map/GeolocationMap.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/map/GeolocationMap.tsx b/src/components/map/GeolocationMap.tsx index 1dee2b50..4e2eaaa8 100644 --- a/src/components/map/GeolocationMap.tsx +++ b/src/components/map/GeolocationMap.tsx @@ -18,8 +18,6 @@ export default function GeoLocationMap({ onPermissionStatusChanged, zoom = 13, }: GeoLocationMapProps) { - const [status, setStatus] = useState('unknown'); - const mapContainerRef = useRef(null); const mapRef = useRef(null); @@ -82,7 +80,9 @@ export default function GeoLocationMap({ onPermissionStatusChanged(permissionStatus.state); } - geolocateControl.trigger(); + if (permissionStatus.state === 'granted') { + geolocateControl.trigger(); + } }; });