Skip to content

Commit 0905594

Browse files
committed
feat: GPS 추적 UI 개선 및 모바일 long-press 컨텍스트 메뉴 최적화
1 parent 9004b73 commit 0905594

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

hooks/useGpsTracking.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,17 @@ const useGpsTracking = ({
295295
}, [compassHeading, myLocation, map, updateUserLocationMarker]);
296296

297297
// Cleanup: Stop tracking location when component unmounts
298+
// Only clean up if map is being destroyed (not just navigating between pages)
298299
useEffect(() => {
299300
return () => {
301+
// Don't clean up if map still exists (just navigation)
302+
// Map will persist across page navigations
303+
if (map) {
304+
// Map still exists, keep tracking and marker
305+
return;
306+
}
307+
308+
// Map is being destroyed, clean up everything
300309
const currentWatchId = useMapStore.getState().gpsWatchId;
301310
const currentMarker = useMapStore.getState().userLocationMarker;
302311

@@ -312,7 +321,7 @@ const useGpsTracking = ({
312321

313322
setIsTrackingLocation(false);
314323
};
315-
}, [setGpsWatchId, setUserLocationMarker, setIsTrackingLocation]);
324+
}, [map, setGpsWatchId, setUserLocationMarker, setIsTrackingLocation]);
316325

317326
return {
318327
gpsState,

0 commit comments

Comments
 (0)