Skip to content

Commit

Permalink
fix: remove async effect
Browse files Browse the repository at this point in the history
  • Loading branch information
vesameskanen committed Dec 5, 2024
1 parent 0f9b4c8 commit e2c2a31
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/component/itinerary/navigator/NaviContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ function NaviContainer(
setOrigin(orig);
}, [itinerary]);

useEffect(async () => {
let permissionGranted;
useEffect(() => {
if (position.hasLocation) {
permissionGranted = true;
} else {
const permission = await checkPositioningPermission();
permissionGranted = permission.state === 'granted';
}
if (permissionGranted) {
mapRef?.enableMapTracking();
setPositioningAllowed(true);
} else {
checkPositioningPermission().then(permission => {
if (permission.state === 'granted') {
mapRef?.enableMapTracking();
setPositioningAllowed(true);
}
});
}
setPositioningAllowed(permissionGranted);
}, [mapRef]);

const { realTimeLegs, time } = useRealtimeLegs(
Expand Down

0 comments on commit e2c2a31

Please sign in to comment.