Skip to content

[feat] /mycd playlistId 기반 라우팅 처리#117

Merged
maylh merged 6 commits intodevelopfrom
feat/#116/mycd-routing
Oct 24, 2025
Merged

[feat] /mycd playlistId 기반 라우팅 처리#117
maylh merged 6 commits intodevelopfrom
feat/#116/mycd-routing

Conversation

@maylh
Copy link
Collaborator

@maylh maylh commented Oct 24, 2025

🛰️ 관련 이슈


✨ 주요 변경 사항

  • /mycd playlistId 기반 라우팅 처리
  • /mycd 탭 query param 적용

🔍 테스트 방법 / 체크리스트

  • 없음

🗯️ PR 포인트

모두 재생 버튼 클릭 시 아래와 같이 라우팅 처리 부탁드립니다 ~

  • 좋아요한 CD 탭으로 이동할 경우: playlistId랑 type=LIKE 전달
  • 나의 CD 탭으로 이동할 경우 : playlistId만 전달

🚀 알게된 점


📖 참고 자료 (선택)

Summary by CodeRabbit

  • New Features

    • 가로/세로 스와이프 캐러셀 지원 추가 및 캐러셀 선택 시 지정한 기본 경로로 이동(URL 유지).
    • MyCD에서 URL 기반 탭·플레이리스트 동기화로 특정 재생목록 직접 접근 가능.
    • CD 컴포넌트에 'mycd' 렌더링 옵션 추가.
  • Refactor

    • MyCD 관련 라우팅을 파라미터화하여 경로 구조 및 URL 동기화를 단순화.
    • 플레이리스트 이동 시 URL 경로 방식으로 네비게이션 변경.

@maylh maylh self-assigned this Oct 24, 2025
@maylh maylh added the HIGH 빠르게 처리해야 하는 높은 우선순위 label Oct 24, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @maylh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 /mycd 페이지의 사용자 경험을 향상시키기 위해 라우팅 방식을 개선하고, 캐러셀 컴포넌트의 유연성을 높이는 데 중점을 둡니다. 이제 사용자는 특정 플레이리스트로 직접 이동하거나, URL을 통해 탭 상태를 공유할 수 있게 됩니다. 이는 코드의 재사용성을 높이고, 애플리케이션의 상태 관리를 URL과 연동하여 더욱 견고하게 만듭니다.

Highlights

  • MyCD 페이지 라우팅 개선: /mycd 페이지에서 playlistId를 기반으로 라우팅을 처리하고, 탭 선택 시 URL 쿼리 파라미터(type=LIKE)를 적용하도록 변경되었습니다.
  • SwipeCarousel 컴포넌트 재사용성 증대: 기존 SwipeCarousel 컴포넌트에 axis('x' 또는 'y') 및 basePath prop을 추가하여 수평/수직 캐러셀 모두에 활용 가능하도록 재사용성을 높였습니다.
  • MyCD 페이지 캐러셀 구현 변경: MyCD 페이지의 플레이리스트 캐러셀이 기존 LoopCarousel에서 재사용성이 개선된 SwipeCarousel 컴포넌트로 대체되었습니다.
  • URL 파라미터 기반 초기화: MyCD 페이지 진입 시 URL의 playlistId 및 type 쿼리 파라미터를 읽어 초기 탭 선택 및 중앙 플레이리스트를 설정하도록 로직이 추가되었습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Oct 24, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

SwipeCarousel이 축(axis)과 basePath를 받도록 확장되고, MyCD/tracklist 라우트가 선택적 id 파라미터로 변경되었습니다. 여러 페이지(Discover, MyCD, PlaylistCarousel, ActionBar)가 URL 파라미터 기반으로 동기화되도록 수정되었습니다.

Changes

Cohort / File(s) 변경 사항
SwipeCarousel 확장
src/features/swipe/ui/SwipeCarousel.tsx
`axis: 'x'
페이지에서의 SwipeCarousel 사용
src/pages/discover/index.tsx, src/pages/mycd/ui/PlaylistCarousel.tsx
SwipeCarousel 호출에 axisbasePath 전달하도록 변경 (discover에 axis="y", basePath="/discover"); LoopCarousel → SwipeCarousel 교체 및 데이터 매핑(PlaylistInfo[])
MyCD 페이지 라우팅/상태 동기화
src/pages/mycd/index.tsx
URL params/쿼리(useParams, useLocation) 기반으로 selectedTab 및 centerPlaylist 초기화/동기화; 탭/센터 변경 시 navigate로 URL 업데이트(타입 쿼리 반영)
트랙리스트 라우팅 파라미터화
src/pages/mycd/tracklist/index.tsx
location.state 대신 useParamsid 추출, usePlaylistDetail(Number(id))로 변경
라우트 구성 변경
src/shared/config/routesConfig.ts
MyCD 라우트를 선택적 파라미터로 변경: /mycd/:id?/mycd/:id?/tracklist로 수정
Cd 컴포넌트 변형 추가
src/shared/ui/Cd.tsx
CdProps.variant에 'mycd' 추가 및 sizeMap에 mycd: { container:260, base:260, borderRadius:0 } 추가
ActionBar 네비게이션 수정
src/widgets/playlist/ActionBar.tsx
플레이리스트 이동 시 navigate('/mycd/${playlistId}/tracklist') 형태로 URL 경로에 ID 포함하도록 변경(이전 state 전달 방식 제거)

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Page as MyCD Page
    participant Router as Router
    participant Swipe as SwipeCarousel

    Note over User,Page: 페이지 로드 (/mycd/:id? or /discover)
    User->>Page: 접근
    Page->>Router: useParams / useLocation 읽음
    Page->>Page: 초기 selectedTab, centerPlaylist 결정
    Page->>Swipe: data + axis + basePath 전달

    User->>Swipe: 스와이프 / 항목 선택
    Swipe->>Page: onSelectIndexChange(index)
    Page->>Router: navigate(`${basePath}/${id}?type=...`) (쿼리 유지)
    Router->>Page: URL 업데이트 → 상태 동기화
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • hansololiviakim

Poem

🐰 길 따라 URL을 깔고,
축을 바꿔 스와이프 뛰며,
플레이리스트는 길 위에 놓였네.
탭도 쿼리도 손잡고 춤추니,
나는 당근 들고 환호한다 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed PR 제목 "[feat] /mycd playlistId 기반 라우팅 처리"는 변경 사항의 핵심을 명확하게 설명합니다. 제목은 /mycd 경로에서 playlistId 기반 라우팅을 구현한다는 주요 목표를 직접적으로 반영하며, 간결하고 구체적입니다. 변경 내용 전체를 포괄하지 않아도 되지만, 개발자가 스캔할 때 주요 변경을 충분히 이해할 수 있는 수준입니다.
Linked Issues Check ✅ Passed 이슈 #116의 요구사항 두 가지 모두 충족되었습니다. 첫째, playlistId 기반 라우팅 처리: routesConfig.ts에서 경로를 :id? 파라미터로 변경했고, mycd/index.tsx에서 useParams와 useLocation으로 라우트 기반 상태 관리를 구현했으며, ActionBar.tsx에서 네비게이션을 URL 경로 기반으로 변경했습니다. 둘째, 탭 쿼리 파라미터 적용: mycd/index.tsx에서 ?type=LIKE 쿼리 파라미터 처리를 추가하고 탭 선택 시 URL을 업데이트합니다.
Out of Scope Changes Check ✅ Passed 대부분의 변경 사항이 이슈 #116의 범위 내에 있습니다. SwipeCarousel의 axis와 basePath 속성 추가는 PlaylistCarousel에서 URL 기반 네비게이션을 구현하기 위해 필수적이며, discover/index.tsx의 변경은 새로운 SwipeCarousel API를 적용하는 필요한 업데이트입니다. Cd.tsx의 'mycd' 변형 추가와 트레이슬리스트 페이지의 useParams 적용도 주요 기능 구현을 직접 지원합니다.
Description Check ✅ Passed PR 설명은 저장소의 템플릿 구조를 잘 따르고 있습니다. 관련 이슈(close #116), 주요 변경 사항(2가지 항목), 테스트 방법(없음), PR 포인트(라우팅 요구사항 명시)가 모두 작성되었습니다. 알게된 점과 참고 자료는 작성되지 않았지만, 이들은 필수 항목이 아니며 핵심 정보는 모두 포함되어 있습니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/#116/mycd-routing

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Oct 24, 2025

🎵 Storybook Link 🎵
🔗 https://689dbb45f8d09aea7832eeb1-mwcqqcpvgs.chromatic.com/

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이번 PR은 /mycd 페이지의 라우팅을 playlistId와 쿼리 파라미터를 사용하도록 개선하여, 상태를 URL로 관리할 수 있게 만든 점이 인상적입니다. SwipeCarousel 컴포넌트를 axisbasePath prop을 받도록 일반화하여 재사용성을 높인 점도 좋습니다. 전체적으로 코드의 상태 관리와 라우팅 구조가 더 견고해졌습니다. 몇 가지 성능 최적화 및 가독성 향상을 위한 제안을 리뷰에 남겼으니 확인 부탁드립니다.

Comment on lines +49 to +56
const playlistInfoData: PlaylistInfo[] = data.map((p) => ({
playlistId: p.playlistId,
playlistName: p.playlistName,
creator: { creatorId: '0', creatorNickname: '' },
genre: '',
songs: [],
isPublic: true,
}))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

playlistInfoData 배열이 컴포넌트가 리렌더링될 때마다 새로 생성되고 있습니다. data prop이 변경되지 않는 한 이 값은 동일하게 유지될 수 있으므로, 불필요한 계산을 피하고 성능을 최적화하기 위해 useMemo로 감싸는 것을 권장합니다.1

  const playlistInfoData: PlaylistInfo[] = useMemo(
    () =>
      data.map((p) => ({
        playlistId: p.playlistId,
        playlistName: p.playlistName,
        creator: { creatorId: '0', creatorNickname: '' },
        genre: '',
        songs: [],
        isPublic: true,
      })),
    [data]
  )

Style Guide References

Footnotes

  1. 불필요한 리렌더링을 줄이고 성능을 최적화하기 위해 useMemo와 같은 React 최적화 기법을 적절하게 사용해야 합니다. 이 경우, data prop이 변경될 때만 playlistInfoData를 다시 계산하도록 useMemo를 사용하는 것이 좋습니다.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/pages/mycd/index.tsx (1)

40-43: 타입 안전성을 위한 상수 사용 권장.

'LIKE' 문자열 리터럴 대신 MyCdTab 타입을 활용한 상수를 사용하면 타입 안전성을 높일 수 있습니다.

다음과 같이 리팩토링을 고려하세요:

  const { id: routePlaylistId } = useParams<{ id?: string }>()
  const { search } = useLocation()
  const typeParam = new URLSearchParams(search).get('type')
-  const [selectedTab, setSelectedTab] = useState<MyCdTab>(typeParam === 'LIKE' ? 'LIKE' : 'MY')
+  const [selectedTab, setSelectedTab] = useState<MyCdTab>((typeParam as MyCdTab) === 'LIKE' ? 'LIKE' : 'MY')
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 30fc376 and dde19dd.

📒 Files selected for processing (8)
  • src/features/swipe/ui/SwipeCarousel.tsx (4 hunks)
  • src/pages/discover/index.tsx (1 hunks)
  • src/pages/mycd/index.tsx (4 hunks)
  • src/pages/mycd/tracklist/index.tsx (1 hunks)
  • src/pages/mycd/ui/PlaylistCarousel.tsx (3 hunks)
  • src/shared/config/routesConfig.ts (1 hunks)
  • src/shared/ui/Cd.tsx (2 hunks)
  • src/widgets/playlist/ActionBar.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

**/*.{ts,tsx,js,jsx}: ## 1. 일반적인 코딩 컨벤션

포맷팅

  • .prettierrc 설정에 따라 포맷팅 확인
  • 들여쓰기: 2칸 스페이스
  • 최대 줄 길이: 100자
  • 세미콜론 사용 안함
  • 따옴표: 작은따옴표 사용
  • 괄호 안 공백: 있음
  • 화살표 함수 괄호: 항상 사용
  • 줄바꿈: LF 사용

네이밍 컨벤션

  • 컴포넌트: PascalCase (예: UserProfile)
  • 유틸리티/훅/변수: camelCase (예: getUserData, useUserInfo)
  • 상수: UPPER_SNAKE_CASE (예: API_BASE_URL)
  • 이미지 파일: kebab-case (예: user-profile-icon.png)

주석 사용

  • 복잡한 로직에만 주석 추가
  • 불필요한 주석 지양 (코드로 설명 가능한 것)
  • TODO/FIXME 형식: // TODO: 설명 - 작성자

가독성

  • 매직 넘버 지양, 의미있는 상수 사용
  • 함수는 하나의 책임만 가지도록 작성 (최대 20줄 권장)
  • 중첩 깊이 최소화 (3단계 이하 권장)

2. React 모범 사례

컴포넌트 작성

  • 최신 React hooks 사용 권장
  • 컴포넌트는 단일 책임 원칙 준수
  • Presentational/Container 컴포넌트 분리
  • 성능 최적화: memo, useCallback, useMemo 적절히 사용
  • 대용량 리스트는 가상화 라이브러리 사용 고려

상태 관리

  • Zustand와 Tanstack Query를 일관되게 사용
  • 상태 구조는 정규화된 형태로 관리
  • 에러 처리: Error Boundary와 try-catch 또는 onError 콜백 활용

3. 스타일링

Styled Components

  • Styled Components 일관되게 사용
  • 스타일드 컴포넌트명은 의미있게 작성
  • 동적 스타일링은 props나 CSS 변수 활용
  • 테마 시스템 활용하여 글로벌 스타일 관리
  • 재사용 가능한 스타일은 mixin이나 확장으로 관리
  • CSS 포맷팅 가독성 유지
  • 사용하지 않는 스타일이나 중복 스타일 제거

4. Vite 및 빌드 최적화

  • 모듈 import 최적화 (tree-shaking 고려)
  • 환경변수는 .env 파일로 관리
  • vite.config.ts에서 빌드 성능 튜닝 (sourcemap 설정, 플러그인 최적화 등)

5. 아키텍처 및 개발 환경

폴더 구조

  • Feature-Sliced Design (FSD) 구조 준수
  • 레이어별 참조 규칙 엄격히 적용

타입스크립트

  • strict 모드 사용
  • 타입 명시적으로 작성 (any 사용 지양)
  • path alias (@/_) 절대 경로 import 사용

Git 훅

  • Husky 설정으로 pre-commit, commit-msg 린팅 확인

6. 기타 가이드라인

  • 충분한 근거와 함께 리뷰 제공
  • 정보 검증 후 답변
  • 간결하고 명확한 응답
  • 필요시 추가 컨텍스트 요청
  • 검증되지 않은 주장 지양
  • 가능한 경우 출처 명시
  • 별도 언급 없으면 JavaScript 기준
  • 한국어로 응답
  • 대부분 브라우저에서 지원하는 ES6+ 기능 활용
  • 코드 리뷰를 통한 유지보수성 향상에 적극 활용

Files:

  • src/shared/ui/Cd.tsx
  • src/widgets/playlist/ActionBar.tsx
  • src/pages/mycd/ui/PlaylistCarousel.tsx
  • src/pages/discover/index.tsx
  • src/pages/mycd/index.tsx
  • src/features/swipe/ui/SwipeCarousel.tsx
  • src/shared/config/routesConfig.ts
  • src/pages/mycd/tracklist/index.tsx
🧬 Code graph analysis (3)
src/pages/mycd/ui/PlaylistCarousel.tsx (1)
src/entities/playlist/types/playlist.ts (1)
  • PlaylistInfo (62-74)
src/pages/mycd/index.tsx (4)
src/features/auth/store/authStore.ts (1)
  • useAuthStore (7-52)
src/shared/lib/useDevice.ts (1)
  • useDevice (14-17)
src/pages/mycd/ui/HeaderTab.tsx (1)
  • MyCdTab (5-5)
src/entities/playlist/model/useMyCd.ts (2)
  • useMyCdList (11-17)
  • useMyLikedCdList (19-25)
src/pages/mycd/tracklist/index.tsx (1)
src/entities/playlist/model/usePlaylists.ts (1)
  • usePlaylistDetail (45-51)
🪛 GitHub Check: Build and Lint
src/features/swipe/ui/SwipeCarousel.tsx

[warning] 50-50:
React Hook useCallback has missing dependencies: 'basePath' and 'location.search'. Either include them or remove the dependency array

🔇 Additional comments (9)
src/shared/config/routesConfig.ts (1)

66-67: LGTM!

옵셔널 파라미터를 사용한 라우트 구조가 올바르게 정의되었습니다. 빈 플레이리스트 상태와 파라미터 기반 네비게이션을 모두 지원할 수 있습니다.

src/pages/mycd/index.tsx (1)

63-86: URL 동기화 로직이 잘 구현되었습니다.

라우트 파라미터와 쿼리 파라미터를 활용한 초기화 로직이 적절하게 작성되었습니다. 의존성 배열도 올바르게 설정되어 있습니다.

src/widgets/playlist/ActionBar.tsx (1)

30-36: LGTM!

상태 기반 네비게이션에서 URL 파라미터 기반 네비게이션으로의 전환이 올바르게 구현되었습니다. 라우트 설정과 일치합니다.

src/pages/discover/index.tsx (1)

154-159: LGTM!

SwipeCarousel에 axisbasePath props를 추가하여 수직 스와이프와 URL 기반 네비게이션을 지원합니다. 구현이 적절합니다.

src/shared/ui/Cd.tsx (1)

25-25: LGTM!

새로운 mycd variant가 기존 패턴과 일관되게 추가되었습니다. 사이즈 설정도 적절합니다.

Also applies to: 141-141

src/pages/mycd/ui/PlaylistCarousel.tsx (2)

27-33: LGTM!

URL 파라미터 기반으로 activeIndex를 동기화하는 로직이 올바르게 구현되었습니다.


49-56: SwipeCarousel는 creator 필드를 사용하지 않습니다.

검증 결과, SwipeCarouselPlaylistInfo 데이터에서 playlistId만 사용하여 캐러셀 네비게이션 로직을 처리합니다. 더미 creator 데이터(creatorId: '0', creatorNickname: '')는 접근되지 않으며, 실제 UI 렌더링(Cd 컴포넌트)은 원본 data 배열을 사용하므로 영향을 주지 않습니다.

Likely an incorrect or invalid review comment.

src/features/swipe/ui/SwipeCarousel.tsx (2)

63-72: axis 기반 조건부 렌더링이 적절합니다.

수평(x)과 수직(y) 레이아웃을 분리하여 처리하는 로직이 명확하고 올바르게 구현되었습니다.


34-37: Embla 설정 검증 필요.

axis === 'x'일 때만 루프를 활성화하고 있습니다. 이것이 의도된 동작인지 확인이 필요합니다. 수직 캐러셀에서도 루프가 필요할 수 있습니다.

다음을 확인하세요:

  • 수직 캐러셀(discover 페이지)에서 루프 동작이 필요한지 제품 요구사항 검토
  • 필요하다면 loop: true로 변경 고려

Copy link
Member

@hansololiviakim hansololiviakim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 감사합니다! 바로 붙여볼게요👍👍

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/features/swipe/ui/SwipeCarousel.tsx (1)

62-72: 불필요한 Fragment 제거 및 일관성 개선 필요.

  1. 불필요한 Fragment: 62-72번 라인의 빈 Fragment(<>)는 조건부로 단일 요소만 반환하므로 제거할 수 있습니다.

  2. ref 래퍼의 비일관성: 수평(x) 캐러셀은 스타일이 없는 일반 div에 ref를 적용하지만(64번 라인), 수직(y) 캐러셀은 스타일이 적용된 EmblaViewport를 사용합니다(68번 라인). 이로 인해 수평 캐러셀에서 overflow나 height 처리가 누락될 수 있습니다.

다음과 같이 리팩토링을 고려해보세요:

-  return (
-    <>
-      {axis === 'x' ? (
-        <div ref={emblaRef}>
-          <HorizontalContainer>{children}</HorizontalContainer>
-        </div>
-      ) : (
-        <EmblaViewport ref={emblaRef}>
-          <VerticaContainer>{children}</VerticaContainer>
-        </EmblaViewport>
-      )}
-    </>
-  )
+  return axis === 'x' ? (
+    <HorizontalViewport ref={emblaRef}>
+      <HorizontalContainer>{children}</HorizontalContainer>
+    </HorizontalViewport>
+  ) : (
+    <EmblaViewport ref={emblaRef}>
+      <VerticalContainer>{children}</VerticalContainer>
+    </EmblaViewport>
+  )

그리고 수평용 Viewport를 추가:

const HorizontalViewport = styled.div`
  width: 100%;
  overflow: hidden;
`
src/pages/mycd/index.tsx (1)

63-86: navigate 호출 중복 가능성을 고려해야 합니다.

현재 구현에서는 탭 전환 시 두 곳에서 navigate가 호출될 수 있습니다:

  1. handleTabSelect에서 탭 변경 시 URL 업데이트
  2. 이후 useEffectselectedTab 변경을 감지하고, route에 해당하는 playlist가 없으면 다시 navigate 호출

시나리오 예시:

  • 사용자가 MY 탭의 playlist 123에서 LIKE 탭으로 전환
  • handleTabSelect/mycd/123?type=LIKE로 navigate
  • 만약 playlist 123이 LIKE 목록에 없으면, useEffect가 첫 번째 LIKE playlist로 다시 navigate

replace: true를 사용하고 있어 히스토리 문제는 없지만, 이러한 동작이 의도된 것인지 확인하고, 필요하다면 조건을 추가하여 불필요한 navigate 호출을 방지하는 것을 고려해 보세요.

예를 들어, 탭 전환 시 현재 playlist가 새 탭의 목록에 존재하는지 먼저 확인할 수 있습니다:

const handleTabSelect = (tab: MyCdTab) => {
  setSelectedTab(tab)
  
  // 새 탭의 플레이리스트 데이터 확인
  const newPlaylistQuery = tab === 'MY' ? myCdPlaylist : likedCdPlaylist
  const newPlaylistData = newPlaylistQuery.data?.filter((p) => tab !== 'MY' || p.isPublic)
  
  // 현재 centerPlaylist가 새 탭에 존재하는지 확인
  const existsInNewTab = newPlaylistData?.some(p => p.playlistId === centerPlaylist.playlistId)
  
  const basePath = existsInNewTab && centerPlaylist.playlistId 
    ? `/mycd/${centerPlaylist.playlistId}` 
    : newPlaylistData?.[0] ? `/mycd/${newPlaylistData[0].playlistId}` : '/mycd'

  const path = tab === 'LIKE' ? `${basePath}?type=LIKE` : basePath

  navigate(path, { replace: true })
}
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dde19dd and 33e9efc.

📒 Files selected for processing (2)
  • src/features/swipe/ui/SwipeCarousel.tsx (4 hunks)
  • src/pages/mycd/index.tsx (4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

**/*.{ts,tsx,js,jsx}: ## 1. 일반적인 코딩 컨벤션

포맷팅

  • .prettierrc 설정에 따라 포맷팅 확인
  • 들여쓰기: 2칸 스페이스
  • 최대 줄 길이: 100자
  • 세미콜론 사용 안함
  • 따옴표: 작은따옴표 사용
  • 괄호 안 공백: 있음
  • 화살표 함수 괄호: 항상 사용
  • 줄바꿈: LF 사용

네이밍 컨벤션

  • 컴포넌트: PascalCase (예: UserProfile)
  • 유틸리티/훅/변수: camelCase (예: getUserData, useUserInfo)
  • 상수: UPPER_SNAKE_CASE (예: API_BASE_URL)
  • 이미지 파일: kebab-case (예: user-profile-icon.png)

주석 사용

  • 복잡한 로직에만 주석 추가
  • 불필요한 주석 지양 (코드로 설명 가능한 것)
  • TODO/FIXME 형식: // TODO: 설명 - 작성자

가독성

  • 매직 넘버 지양, 의미있는 상수 사용
  • 함수는 하나의 책임만 가지도록 작성 (최대 20줄 권장)
  • 중첩 깊이 최소화 (3단계 이하 권장)

2. React 모범 사례

컴포넌트 작성

  • 최신 React hooks 사용 권장
  • 컴포넌트는 단일 책임 원칙 준수
  • Presentational/Container 컴포넌트 분리
  • 성능 최적화: memo, useCallback, useMemo 적절히 사용
  • 대용량 리스트는 가상화 라이브러리 사용 고려

상태 관리

  • Zustand와 Tanstack Query를 일관되게 사용
  • 상태 구조는 정규화된 형태로 관리
  • 에러 처리: Error Boundary와 try-catch 또는 onError 콜백 활용

3. 스타일링

Styled Components

  • Styled Components 일관되게 사용
  • 스타일드 컴포넌트명은 의미있게 작성
  • 동적 스타일링은 props나 CSS 변수 활용
  • 테마 시스템 활용하여 글로벌 스타일 관리
  • 재사용 가능한 스타일은 mixin이나 확장으로 관리
  • CSS 포맷팅 가독성 유지
  • 사용하지 않는 스타일이나 중복 스타일 제거

4. Vite 및 빌드 최적화

  • 모듈 import 최적화 (tree-shaking 고려)
  • 환경변수는 .env 파일로 관리
  • vite.config.ts에서 빌드 성능 튜닝 (sourcemap 설정, 플러그인 최적화 등)

5. 아키텍처 및 개발 환경

폴더 구조

  • Feature-Sliced Design (FSD) 구조 준수
  • 레이어별 참조 규칙 엄격히 적용

타입스크립트

  • strict 모드 사용
  • 타입 명시적으로 작성 (any 사용 지양)
  • path alias (@/_) 절대 경로 import 사용

Git 훅

  • Husky 설정으로 pre-commit, commit-msg 린팅 확인

6. 기타 가이드라인

  • 충분한 근거와 함께 리뷰 제공
  • 정보 검증 후 답변
  • 간결하고 명확한 응답
  • 필요시 추가 컨텍스트 요청
  • 검증되지 않은 주장 지양
  • 가능한 경우 출처 명시
  • 별도 언급 없으면 JavaScript 기준
  • 한국어로 응답
  • 대부분 브라우저에서 지원하는 ES6+ 기능 활용
  • 코드 리뷰를 통한 유지보수성 향상에 적극 활용

Files:

  • src/features/swipe/ui/SwipeCarousel.tsx
  • src/pages/mycd/index.tsx
🧬 Code graph analysis (1)
src/pages/mycd/index.tsx (4)
src/features/auth/store/authStore.ts (1)
  • useAuthStore (7-52)
src/shared/lib/useDevice.ts (1)
  • useDevice (14-17)
src/pages/mycd/ui/HeaderTab.tsx (1)
  • MyCdTab (5-5)
src/entities/playlist/model/useMyCd.ts (2)
  • useMyCdList (11-17)
  • useMyLikedCdList (19-25)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Run Chromatic
🔇 Additional comments (11)
src/features/swipe/ui/SwipeCarousel.tsx (6)

1-2: LGTM!

useLocation import가 올바르게 추가되었으며, 쿼리 파라미터 보존을 위해 적절히 사용되고 있습니다.


9-15: LGTM!

인터페이스 확장이 적절합니다. axisbasePath 속성이 명확하게 정의되어 있으며, 컴포넌트의 재사용성을 높입니다.


26-26: LGTM!

useLocation 훅을 사용하여 쿼리 파라미터를 보존하는 것은 올바른 접근입니다. 이는 PR 목표인 query param 기반 탭 선택과 일치합니다.


33-38: axis에 따른 비대칭 동작 확인 필요.

수평(x) 캐러셀은 루프가 활성화되고 3개 이하일 때 containScroll이 비활성화되지만, 수직(y) 캐러셀은 항상 루프가 비활성화되고 containScroll이 'trimSnaps'로 설정됩니다. 이러한 비대칭 동작이 의도된 것인지 확인해주세요.

특히 수직 캐러셀에서도 데이터가 적을 때 특별한 처리가 필요한지 검토가 필요합니다.


40-50: 의존성 배열 수정 확인.

이전 리뷰에서 지적된 basePathlocation.search 누락 문제가 50번 라인에서 올바르게 수정되었습니다. stale closure 문제가 해결되었습니다.


89-92: LGTM!

HorizontalContainer의 스타일링이 적절합니다. touch-action: pan-x pinch-zoom는 수평 스와이프를 위한 올바른 설정입니다.

src/pages/mycd/index.tsx (5)

1-2: 필요한 의존성이 올바르게 추가되었습니다.

URL 기반 라우팅 처리를 위한 useMemo, useLocation, useParamsMyCdTab 타입이 적절하게 import되었습니다.

Also applies to: 13-13


40-43: URL 파라미터 기반 탭 상태 초기화가 올바르게 구현되었습니다.

route 파라미터와 query 파라미터를 적절히 파싱하여 초기 탭 상태를 설정하고 있습니다.


88-97: 탭 선택 시 URL 업데이트가 올바르게 구현되었습니다.

type=LIKE query 파라미터를 LIKE 탭에만 추가하고, replace: true를 사용하여 히스토리를 깔끔하게 유지하고 있습니다.


99-117: 캐러셀 드래그 시 URL 동기화가 올바르게 구현되었습니다.

선택된 탭에 따라 적절한 query 파라미터를 포함하여 URL을 업데이트하고 있으며, selectedTab을 의존성 배열에 포함시켜 탭 변경 시에도 올바르게 동작하도록 구현되었습니다.


50-54: MY 탭 필터링 로직에 대한 비즈니스 요구사항 재확인이 필요합니다.

검증 결과, 코드에서 다음 불일치가 확인되었습니다:

  • 마이페이지 (MyCdList): useMyCdList()로 조회한 모든 플레이리스트 표시 (공개/비공개 모두 포함, 비공개 배지로 표시)
  • 나의 CD 페이지: MY 탭에서만 isPublic === true인 항목만 필터링하여 표시

같은 API 엔드포인트(/main/playlist/mypage/me)에서 반환하는 데이터를 부분적으로 필터링하면서 사용자에게 혼란을 초래할 수 있습니다. 개발자가 다음을 확인하기 바랍니다:

  1. 현재 MY 탭 필터링이 의도된 동작인지
  2. 두 페이지 간 일관된 UX가 필요한지
  3. 필터링이 필요하다면 마이페이지에도 동일하게 적용할지 여부

Comment on lines +83 to 87
const VerticaContainer = styled.div`
display: flex;
flex-direction: column;
height: 100%;
`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

오타 수정 필요.

VerticaContainer는 오타입니다. VerticalContainer로 수정해야 합니다.

다음 diff를 적용하세요:

-const VerticaContainer = styled.div`
+const VerticalContainer = styled.div`
   display: flex;
   flex-direction: column;
   height: 100%;
 `

그리고 69번 라인의 사용처도 함께 수정:

-          <VerticaContainer>{children}</VerticaContainer>
+          <VerticalContainer>{children}</VerticalContainer>

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/features/swipe/ui/SwipeCarousel.tsx around lines 83 to 87 (and usage at
line 69), rename the styled component identifier from VerticaContainer to
VerticalContainer to fix the typo; update the styled declaration name and all
references (including the use at line 69) to VerticalContainer so the component
compiles and imports match the corrected name.

@maylh maylh merged commit be44d8a into develop Oct 24, 2025
4 checks passed
@maylh maylh deleted the feat/#116/mycd-routing branch October 24, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

HIGH 빠르게 처리해야 하는 높은 우선순위

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] /mycd playlistId 기반 라우팅 처리

2 participants