-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor/#79 가독성을 위한 리팩토링 #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- HeroProvider, NaverMapProvider, QueryClientProvider 이동
…d로 변경 및 bottomOffset prop 추가
- contents prop을 children으로 변경
|
Caution Review failedThe pull request is closed. Walkthrough배너 컴포넌트를 캐러셀로 교체하고, HydrationBoundaryPage 임포트 경로를 정규화하며, 지도 컴포넌트에 디바운싱 로직을 추가하고, PreviewPlace를 PlaceSummaryCard로 이름 변경하고, 새로운 useDebounced 훅을 도입했습니다. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant MapComponent
participant useDebounced
participant NaverMap
participant PlaceMarker
participant PlaceSummaryCard
User->>NaverMap: 지도 중심 변경
NaverMap->>MapComponent: onCenterChanged 호출
MapComponent->>useDebounced: 디바운싱된 핸들러 트리거
useDebounced->>MapComponent: 300ms 후 selectedPlaceId 초기화
MapComponent->>MapComponent: selectedPlace 파생값 업데이트
User->>PlaceMarker: 마커 클릭
PlaceMarker->>MapComponent: onClick 콜백 실행
MapComponent->>MapComponent: selectedPlaceId 설정
MapComponent->>PlaceSummaryCard: 선택된 장소 데이터 전달
PlaceSummaryCard->>User: 장소 요약 카드 표시
alt 장소 선택됨
MapComponent->>MapComponent: CurrentLocationButton bottomOffset = BOTTOM_OFFSET.WITH_SUMMARY_CARD (220)
else 장소 선택 안 됨
MapComponent->>MapComponent: CurrentLocationButton bottomOffset = BOTTOM_OFFSET.WITH_BOTTOM_SHEET
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
#️⃣연관된 이슈
#79
📝작업 내용
프로젝트 구조를 정비하고, 지도 관련 컴포넌트의 네이밍 직관성을 높였으며, 지도 조작 시 발생하는 불필요한 연산을 줄이기 위해 성능 최적화를 진행했습니다.
1. 프로젝트 구조 개선 (Providers 디렉토리 분리)
2. 네이밍 리팩토링 (가독성 및 의미 명확화)
3. 지도 인터랙션 성능 최적화 (이벤트 통합 및 Debounce 적용)
기존 문제
지도의 움직임을 감지하기 위해 onTouchEnd, onMouseUp, onZoomChanged 등 여러 이벤트를 개별적으로 관리하여 로직이 분산되어 있었습니다.
해결 방안
이벤트 통합: 지도 중심 좌표 변경 감지를 onCenterChanged 이벤트 하나로 통합하여 로직을 단순화했습니다.
Debounce 적용: 지도 이동 중 수시로 발생하는 이벤트를 제어하기 위해 useDebounced 훅을 적용했습니다.
TypeScript에서 매개변수 반공변성 이슈 해결을 위해 제네릭에 any를 허용하되, Parameters로 타입 안전성을 확보했습니다.
4. Banner 컴포넌트 리팩토링 (Carousel)
이름 변경
Banner → Carousel (슬라이드 기능을 제공하는 컴포넌트의 특성을 더 잘 나타내는 표준적인 이름으로 변경)
인터페이스 개선
contents prop으로 배열을 받던 방식에서, children을 사용하는 방식으로 변경하여 합성 패턴을 적용했습니다.
스크린샷 (선택)
💬리뷰 요구사항(선택)
Summary by CodeRabbit
새로운 기능
개선사항
✏️ Tip: You can customize this high-level summary in your review settings.