Skip to content

[fix] 기능 관련 QA 반영 (홈, 둘러보기, 나의 CD)#125

Merged
maylh merged 8 commits intodevelopfrom
fix/#123/1sp-qa-func
Oct 27, 2025
Merged

[fix] 기능 관련 QA 반영 (홈, 둘러보기, 나의 CD)#125
maylh merged 8 commits intodevelopfrom
fix/#123/1sp-qa-func

Conversation

@maylh
Copy link
Collaborator

@maylh maylh commented Oct 26, 2025

🛰️ 관련 이슈


✨ 주요 변경 사항

홈, 둘러보기, 나의 CD 페이지의 기능 관련 QA 사항들을 수정했습니다

  • CD 생성 내역이 있는 유저의 경우 홈 상단 캐러셀에 나의 CD 리스트가 나오도록 수정
  • 댓글 작성 및 삭제 실시간 반영 안되는 이슈 수정 (SetQueryData & InvalidateQueries)
  • 비공개인 나의 CD 클릭 시 /mycd의 첫 콘텐츠로 이동하는 이슈 수정

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

  • 없음

🗯️ PR 포인트


🚀 알게된 점


📖 참고 자료 (선택)

Summary by CodeRabbit

개선 사항

  • 새 기능

    • 로그인 시 홈 캐러셀에 개인화된 콘텐츠 우선 표시(없을 경우 기존 플레이리스트로 폴백)
    • 캐러셀의 항목 클릭 시 로그인 여부에 따라 개인 컬렉션 또는 발견 페이지로 이동
  • 성능 개선

    • 채팅 메시지 카운트 캐싱 및 즉시 반영 개선(전송/삭제 시 UI가 빠르게 업데이트)
    • 창 포커스 시 불필요한 쿼리 재조회 비활성화
  • 버그 수정/품질 개선

    • 이모지 및 텍스트 메시지 입력 유효성 검증 강화 및 오류 시 롤백 처리
    • 마이 컬렉션 페이지의 중심 항목 선택 및 경로 동작 개선

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

coderabbitai bot commented Oct 26, 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

홈 캐러셀이 사용자 CD 우선 데이터로 변경되고 HomeCarousel의 data 타입과 Cd 관련 props가 갱신되었으며 mycd 페이지의 중심 아이템 상태 및 훅 사용 방식이 리팩토링되었습니다. 채팅 훅들은 쿼리 키/옵션이 변경되고 ChatBottomSheet에 채팅 카운트 옵티미스틱 업데이트가 추가되었습니다.

Changes

Cohort / File(s) 요약
채팅 쿼리 및 UI
src/features/chat/model/useChat.ts, src/widgets/chat/ChatBottomSheet.tsx
useDeleteChatMessage 성공 시 chat-count 쿼리 무효화 추가; useChatCount의 queryKey를 'chat-count'로 변경하고 enabled: !!roomId, refetchOnWindowFocus: false 옵션 추가; ChatBottomSheet에서 queryClientchat-count를 옵티미스틱 업데이트(메시지 전송 시 totalCount 증가) 및 전송 실패 시 롤백하는 handleSendMessage 도입.
홈 페이지 캐러셀 (데이터 타입/소스 변경)
src/pages/home/ui/FirstSection.tsx, src/pages/home/ui/HomeCarousel.tsx
FirstSection에서 로그인 시 MyCdData 우선 전달(없으면 playlists), 비로그인 시 playlists 전달; HomeCarousel의 data prop 타입을 PlaylistInfo[]Slide[]로 변경하고 PlaylistInfo 대신 CdCustomData 타입 사용, Cd 컴포넌트에 전달되는 stickers 접근을 slide.cdItems ?? slide.cdResponse?.cdItems ?? []로 안전하게 처리하고 genre 렌더링에 방어 코드 추가; 클릭 시 로그인 여부에 따라 라우팅 경로 분기 추가.
나의 CD 페이지 리팩토링
src/pages/mycd/index.tsx, src/entities/playlist/...
usePlaylistDetail 등 개별 훅 사용을 useMyCdActions 등으로 통합(새 훅 export); 상태명 centerPlaylistcenterItem으로 변경 및 초기화/네비게이션 로직 갱신, 상세 데이터 소스를 usePlaylistDetailuseMyCdActions(Number(centerItem.playlistId), { enabled: !!centerItem.playlistId })로 전환, 관련 UI/props 및 참가자 카운트 로직도 centerItem 기준으로 업데이트.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ChatUI as ChatBottomSheet
    participant QC as QueryClient
    participant API as Chat API (sendMessage)

    User->>ChatUI: 메시지/이모지 전송
    ChatUI->>ChatUI: 입력·유효성 검사
    ChatUI->>QC: getQueryData('chat-count', roomId)
    ChatUI->>QC: setQueryData('chat-count', totalCount + 1')    %% 옵티미스틱 업데이트 %%
    ChatUI->>API: sendMessage(content)
    alt 성공
        API-->>ChatUI: 응답
        ChatUI->>QC: invalidateQueries(['chat-history', {roomId}])
        ChatUI->>QC: invalidateQueries(['chat-count', {roomId}])
    else 실패
        API-->>ChatUI: 에러
        ChatUI->>QC: setQueryData('chat-count', originalData)  %% 롤백 %%
    end
Loading
sequenceDiagram
    participant Home
    participant MyCdHook as useMyCdList / useMyCdActions
    participant PlaylistAPI
    participant Carousel as HomeCarousel

    Home->>MyCdHook: 요청 (로그인 시)
    alt MyCdData 존재
        MyCdHook-->>Home: MyCdData (Slide[])
        Home->>Carousel: data = MyCdData
    else MyCdData 없음
        Home->>PlaylistAPI: 요청
        PlaylistAPI-->>Home: playlists
        Home->>Carousel: data = playlists
    end
Loading
sequenceDiagram
    participant MyCdPage
    participant Router
    participant Hook as useMyCdActions

    MyCdPage->>Router: route params 확인
    MyCdPage->>MyCdPage: centerItem 초기화 (route 또는 첫 항목)
    MyCdPage->>Hook: useMyCdActions(centerItem.playlistId){enabled}
    Hook-->>MyCdPage: 상세 데이터
    MyCdPage->>Router: centerItem 변경 시 URL 업데이트
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • 주의할 파일/영역:
    • HomeCarousel의 타입 변경이 프로젝트 전반에 미치는 영향(타입 호환성)
    • ChatBottomSheet의 옵티미스틱 업데이트와 useDeleteChatMessage의 invalidation 충돌 여부
    • mycd/index.tsx의 centerItem 초기화·라우팅 경계조건 및 useMyCdActions enabled 플래그

Possibly related PRs

Suggested reviewers

  • hansololiviakim

Poem

"내 발바닥으로 버그 밟아도,
캐러셀엔 내 CD가 반짝반짝,
채팅은 총알같이 더해지고,
centerItem으로 길을 닦았더니,
QA가 함박웃음 지어주네 🐰✨"

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 (3 passed)
Check name Status Explanation
Title Check ✅ Passed PR 제목 "[fix] 기능 관련 QA 반영 (홈, 둘러보기, 나의 CD)"는 변경사항의 주요 의도와 영역을 명확하게 요약합니다. 제목은 구체적이며 실제 코드 변경사항(홈 캐러셀, 댓글 실시간 반영, 나의 CD 네비게이션)과 일치하고, 개발자가 이 PR의 핵심이 QA 피드백 반영임을 쉽게 이해할 수 있습니다.
Out of Scope Changes Check ✅ Passed 모든 코드 변경사항이 linked issue #123의 범위 내에 있습니다. 변경된 다섯 개 파일 모두가 세 가지 목표(홈 캐러셀 개선, 댓글 실시간 반영, 나의 CD 네비게이션) 중 하나 이상과 직접적으로 연결되어 있으며, 범위를 벗어난 변경사항은 발견되지 않습니다.
Description Check ✅ Passed PR 설명은 template의 필수 항목들을 충분히 포함하고 있습니다. 관련 이슈(#123)가 명시되었고, 주요 변경사항이 세 가지 구체적인 수정 사항으로 명확하게 기술되었으며, 테스트 방법도 "없음"으로 명시되었습니다. 선택 사항인 PR 포인트와 알게된 점은 비어있지만, 이는 template 상 필수 항목이 아니므로 문제가 되지 않습니다.
✨ 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 fix/#123/1sp-qa-func

📜 Recent 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 0316a67 and 46fc789.

📒 Files selected for processing (1)
  • src/pages/home/ui/HomeCarousel.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/pages/home/ui/HomeCarousel.tsx

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.

@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은 홈, 둘러보기, 나의 CD 페이지에서 발견된 기능 관련 QA 사항들을 해결하여 사용자 경험을 개선하는 데 중점을 둡니다. 주요 변경 사항으로는 로그인한 사용자의 홈 화면 캐러셀에 개인화된 '나의 CD' 목록을 표시하고, 댓글 기능의 실시간 업데이트 문제를 해결하며, 비공개 '나의 CD' 접근 시 올바른 콘텐츠로 이동하도록 수정하는 것이 포함됩니다.

Highlights

  • 홈 화면 캐러셀 개선: CD 생성 내역이 있는 로그인 사용자에게 홈 화면 상단 캐러셀에 '나의 CD' 목록이 표시되도록 수정되었습니다.
  • 댓글 실시간 반영 문제 해결: 댓글 작성 및 삭제 시 실시간으로 반영되지 않던 문제가 SetQueryDataInvalidateQueries를 사용하여 해결되었습니다.
  • 비공개 나의 CD 탐색 수정: 비공개 '나의 CD'를 클릭했을 때 /mycd의 첫 번째 콘텐츠로 이동하던 문제가 수정되었습니다.
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.

@github-actions
Copy link

github-actions bot commented Oct 26, 2025

🎵 Storybook Link 🎵
🔗 https://689dbb45f8d09aea7832eeb1-tsatwrtqqa.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은 홈, 둘러보기, 나의 CD 페이지의 QA 사항을 반영한 수정으로, 주요 내용은 다음과 같습니다:

  • 홈 화면 캐러셀에 나의 CD 리스트 표시
  • 댓글 작성/삭제 시 실시간 반영 (낙관적 업데이트)
  • 비공개 CD 클릭 시 네비게이션 오류 수정

전반적으로 QA에서 발견된 문제들을 잘 해결하셨습니다. 특히 TanStack Query의 setQueryDatainvalidateQueries를 사용하여 데이터 정합성을 맞추고 사용자 경험을 개선한 점이 좋습니다.

코드 리뷰에서는 주로 명명 규칙 준수, 코드 중복 제거, 가독성 향상과 관련된 몇 가지 개선점을 제안했습니다. 해당 내용들을 확인하시고 반영해주시면 코드의 유지보수성이 더욱 향상될 것입니다.

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: 2

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

53-56: 네이밍 변경 확인 완료.

centerPlaylist에서 centerItem으로 변경되었고, 전체 파일에서 일관성 있게 적용되었습니다. 다만 변수명이 더 명확할 수 있습니다.

centerItem보다는 currentCenterCd 또는 selectedCd가 의미상 더 명확할 수 있습니다. 하지만 현재 네이밍도 충분히 이해 가능하므로 선택 사항입니다.

src/pages/home/ui/HomeCarousel.tsx (2)

16-22: Slide 인터페이스 정의 확인 완료.

새로운 Slide 인터페이스가 CdCustomData와 다양한 데이터 소스(MyCdData, 일반 플레이리스트)를 지원하도록 정의되었습니다.

타입을 별도 파일로 분리하는 것을 고려해보세요:

// src/pages/home/types/carousel.ts
import type { CdCustomData } from '@/entities/playlist'

export interface HomeCarouselSlide {
  playlistId: number
  playlistName: string
  genre?: string
  cdItems?: CdCustomData[]
  cdResponse?: { cdItems?: CdCustomData[] }
}

이렇게 하면 타입 재사용성과 유지보수성이 향상됩니다. 코딩 가이드라인의 Feature-Sliced Design 구조를 더 잘 준수할 수 있습니다.

Based on coding guidelines


69-73: 폴백 체인 로직 확인 완료.

slide.cdItems ?? slide.cdResponse?.cdItems ?? [] 폴백 체인이 다양한 데이터 구조를 안전하게 처리합니다.

반복되는 폴백 로직을 유틸 함수로 추출하면 가독성이 향상됩니다:

// src/shared/lib/getCdItems.ts
import type { CdCustomData } from '@/entities/playlist'

interface SlideWithCdData {
  cdItems?: CdCustomData[]
  cdResponse?: { cdItems?: CdCustomData[] }
}

export const getCdItems = (slide: SlideWithCdData): CdCustomData[] => {
  return slide.cdItems ?? slide.cdResponse?.cdItems ?? []
}

사용:

- stickers={slide.cdItems ?? slide.cdResponse?.cdItems ?? []}
+ stickers={getCdItems(slide)}

Based on coding guidelines

📜 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 ee382a2 and 6e4a302.

📒 Files selected for processing (5)
  • src/features/chat/model/useChat.ts (1 hunks)
  • src/pages/home/ui/FirstSection.tsx (1 hunks)
  • src/pages/home/ui/HomeCarousel.tsx (2 hunks)
  • src/pages/mycd/index.tsx (8 hunks)
  • src/widgets/chat/ChatBottomSheet.tsx (3 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/chat/model/useChat.ts
  • src/pages/home/ui/FirstSection.tsx
  • src/widgets/chat/ChatBottomSheet.tsx
  • src/pages/home/ui/HomeCarousel.tsx
  • src/pages/mycd/index.tsx
🧬 Code graph analysis (4)
src/features/chat/model/useChat.ts (1)
src/features/chat/api/chat.ts (1)
  • getChatCount (18-20)
src/widgets/chat/ChatBottomSheet.tsx (1)
src/features/chat/types/chat.ts (1)
  • ChatCountResponse (22-24)
src/pages/home/ui/HomeCarousel.tsx (1)
src/entities/playlist/types/playlist.ts (1)
  • CdCustomData (8-20)
src/pages/mycd/index.tsx (1)
src/entities/playlist/model/useMyCd.ts (1)
  • useMyCdActions (29-68)
🔇 Additional comments (6)
src/features/chat/model/useChat.ts (2)

36-36: 캐시 무효화 로직 추가 확인 완료.

채팅 메시지 삭제 시 chat-count 캐시를 무효화하여 실시간 업데이트를 보장합니다. ChatBottomSheet.tsx에서 메시지 전송 시 setQueryData로 캐시를 수동 업데이트하는 것과 일관성 있게 동작합니다.


45-49: 쿼리 키 일관성 및 최적화 확인 완료 - 우려사항 없음

검증 결과, 코드베이스에서 이전 'chatCount' 쿼리 키가 남아있지 않으며, 'chat-count' 쿼리 키가 일관되게 적용되었습니다.

라인 45-49의 코드 변경사항:

  • queryKey: ['chat-count', roomId] - 일관된 쿼리 키 사용
  • enabled: !!roomId - roomId 검증 추가로 불필요한 요청 방지
  • refetchOnWindowFocus: false - 윈도우 포커스 시 불필요한 리페치 방지
  • staleTime: 0 - 캐시 타임 설정

모든 설정이 적절하며 chat-countuseDeleteChatMessage()invalidateQueriesChatBottomSheet.tsxsetQueryData에서도 일관되게 사용 중입니다.

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

49-49: playlistData 메모이제이션 단순화 확인 완료.

이전에 isPublic 필터링을 수행하던 로직을 제거하고 단순히 data ?? []로 변경했습니다. 이는 코드를 간결하게 만들지만, 의도적인 변경인지 확인이 필요합니다.

다음을 확인해주세요:

  1. useMyCdListuseMyLikedCdList가 이미 필터링된 데이터를 반환하는지
  2. 비공개 CD가 목록에 포함되어도 문제가 없는지 (나의 CD 페이지이므로 문제없을 수 있음)

이전 로직에서 isPublic 필터링이 있었다면, 그 의도가 무엇이었는지 확인하는 것이 좋습니다.


115-117: 마이그레이션 불완전 및 데이터 호환성 검증 필요.

검증 결과 다음과 같은 문제가 발견되었습니다:

  1. 반환 구조 차이: usePlaylistDetail은 useQuery 객체를 반환하므로 { data, isLoading, isError }로 추출되지만, useMyCdActionstracklist 필드를 직접 반환합니다. 두 데이터 원본이 getTracklistgetPlaylistDetail로 다르므로, 응답 타입이 동일한지 확인 필요합니다.

  2. 마이그레이션 불일치: 같은 src/pages/mycd/ 디렉토리 내에서 혼용 중입니다.

    • src/pages/mycd/index.tsx: useMyCdActions (신규)
    • src/pages/mycd/tracklist/index.tsx: usePlaylistDetail (기존, 여전히 사용)

    같은 기능 영역에서 일관성 있게 훅을 통일해야 합니다.

src/pages/home/ui/HomeCarousel.tsx (1)

75-75: 장르 폴백 처리 확인 완료.

slide.genre ?? ''undefined 에러를 방지합니다.

src/pages/home/ui/FirstSection.tsx (1)

40-40: 홈 캐러셀 데이터 타입 호환성 확인 완료.

MyCdData (CdMetaResponse: (CdBasicInfo & OnlyCdResponse)[])와 playlists (PlaylistInfo[])가 모두 HomeCarouselSlide[] 타입과 호환됩니다.

  • MyCdData: playlistId, playlistName 필드 보유, cdResponse: { cdItems } 구조 포함
  • playlists: playlistId, playlistName, genre 필드 보유, 선택적 cdItems 속성 포함

조건부 폴백 로직 isLogin ? (MyCdData ?? playlists) : playlists은 타입 안전하며, PR 목표인 로그인 사용자의 CD 목록 우선 표시 기능을 올바르게 구현합니다.

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: 0

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

115-117: 에러 및 로딩 상태 처리를 추가하는 것을 권장합니다.

useMyCdActions에서 반환되는 isError, isLoading, isFetching을 활용하지 않고 있습니다. 현재 코드는 playlistDetailundefined일 때 조건부 렌더링으로 어느 정도 대응하고 있지만, 상세 데이터 로딩 중이거나 에러가 발생했을 때 사용자에게 명확한 피드백을 제공하지 못할 수 있습니다.

또한 Number(centerItem.playlistId)playlistIdnull일 때 0으로 변환되므로, 타입 안전성 측면에서 명시적으로 처리하는 것이 더 명확합니다.

다음과 같이 개선할 수 있습니다:

-  const { tracklist: playlistDetail } = useMyCdActions(Number(centerItem.playlistId), {
-    enabled: !!centerItem.playlistId,
-  })
+  const { 
+    tracklist: playlistDetail,
+    isLoading: isDetailLoading,
+    isError: isDetailError
+  } = useMyCdActions(centerItem.playlistId ?? 0, {
+    enabled: centerItem.playlistId !== null,
+  })

그리고 로딩 및 에러 상태를 UI에 반영:

if (isDetailLoading) {
  return <LoadingSpinner />
}

if (isDetailError) {
  // 에러 처리
}
📜 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 6e4a302 and 0316a67.

📒 Files selected for processing (2)
  • src/pages/mycd/index.tsx (8 hunks)
  • src/widgets/chat/ChatBottomSheet.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/widgets/chat/ChatBottomSheet.tsx
🧰 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/pages/mycd/index.tsx
🧬 Code graph analysis (1)
src/pages/mycd/index.tsx (1)
src/entities/playlist/model/useMyCd.ts (1)
  • useMyCdActions (29-68)
🔇 Additional comments (2)
src/pages/mycd/index.tsx (2)

49-49: 성능 최적화 잘 적용되었습니다.

useMemo를 사용하여 불필요한 재렌더링을 방지하는 것은 좋은 접근입니다.


53-56: 상태 변수 네이밍이 올바르게 수정되었습니다.

이전 리뷰에서 지적된 setter 함수명이 camelCase 규칙에 맞게 setCenterItem으로 정확히 작성되었습니다.

@maylh maylh merged commit 4b015ca into develop Oct 27, 2025
4 checks passed
@maylh maylh deleted the fix/#123/1sp-qa-func branch October 27, 2025 13:35
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.

[FIX] 기능 관련 QA 반영 (홈, 둘러보기, 나의 CD)

2 participants