fix : 코스 따라가기 시작 시 전체 코스 포커싱, 데모 시뮬레이션 제거#132
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the demo mode configuration and coordinate simulation logic from the tracking screen, simplifying the location tracking and camera alignment behavior. The review feedback identifies two key issues: first, the location button's press handler does not actually re-enable the real-time tracking follow mode as described in the comments, and a code suggestion is provided to fix this; second, a useEffect hook uses courseCoords but depends on courseDetail?.polyline, which should be updated to depend directly on courseCoords to comply with React Hook rules.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| // 코스 따라가기: 시작 시 전체 코스가 보이도록 follow 비활성 (위치 버튼으로 재활성 가능) | ||
| // 자유기록: 시작 시 현위치 follow 활성 |
There was a problem hiding this comment.
주석과 PR 설명에는 **"위치 버튼으로 재활성 가능"**하다고 언급되어 있으나, 실제 위치 버튼의 onPress 핸들러(1214번 라인 부근)에서는 setIsFollowingUser(true)를 호출하지 않고 카메라만 1회성으로 이동시키고 있습니다.
이로 인해 사용자가 위치 버튼을 눌러도 실시간 위치 추적(follow) 모드가 다시 활성화되지 않고, 움직여도 지도가 사용자를 따라가지 않는 문제가 발생합니다.
위치 버튼의 onPress 핸들러를 다음과 같이 수정하여 실시간 추적도 함께 재활성화되도록 개선해 주세요.
onPress={() => {
const coord = markerCoord ?? userLocation;
if (coord) {
setIsFollowingUser(true); // 실시간 추적 재활성화
mapRef.current?.animateCameraTo({
latitude: coord.latitude,
longitude: coord.longitude,
zoom: 15,
});
}
}}| @@ -703,14 +670,18 @@ export default function TrackingScreen() { | |||
| }, [courseDetail?.polyline, isTracking]); | |||
There was a problem hiding this comment.
useEffect 내부에서 courseCoords를 참조하여 카메라 범위를 계산하고 있지만, 의존성 배열에는 courseDetail?.polyline이 등록되어 있습니다.
courseCoords는 courseDetail?.polyline을 기반으로 계산된 useMemo 값이므로, React Hook 규칙(react-hooks/exhaustive-deps)을 준수하고 잠재적인 버그를 방지하기 위해 의존성 배열에 courseCoords를 직접 전달하는 것이 좋습니다.
| }, [courseDetail?.polyline, isTracking]); | |
| }, [courseCoords, isTracking]); |
요약
변경 파일
app/(tabs)/tracking.tsxDEMO_MODE,DEMO_LAT,DEMO_LNG,DEMO_SIM_INTERVAL_MS,DEMO_SIM_STEP상수 제거useEffect제거isFollowingUser=false→ 전체 코스 fit, 자유기록은isFollowingUser=true→ 현위치 follow테스트 체크리스트