Skip to content

Commit

Permalink
fix: on new permissions trigger geolocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto Milla Martinez committed Nov 7, 2024
1 parent 000b5d2 commit 06df445
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/map/GeolocationMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export default function GeoLocationMap({
onPermissionStatusChanged,
zoom = 13,
}: GeoLocationMapProps) {
const [status, setStatus] = useState<PermissionState | 'unknown'>('unknown');

const mapContainerRef = useRef<HTMLDivElement | null>(null);
const mapRef = useRef<maplibregl.Map | null>(null);

Expand Down Expand Up @@ -82,7 +80,9 @@ export default function GeoLocationMap({
onPermissionStatusChanged(permissionStatus.state);
}

geolocateControl.trigger();
if (permissionStatus.state === 'granted') {
geolocateControl.trigger();
}
};
});

Expand Down

0 comments on commit 06df445

Please sign in to comment.