[refactor] useGetCardList 파라미터를 객체로 변경#823
Conversation
파라미터 순서 오류 방지 및 가독성 향상을 위해 useGetCardList의 파라미터를 객체 형태로 변경했습니다. - UseGetCardListProps 인터페이스 추가 - 파라미터를 객체로 받도록 변경 - category와 division 순서 수정 (queryKey, queryFn 일치) - MainPage 호출부를 객체 형태로 변경
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning
|
| Cohort / File(s) | Change Summary |
|---|---|
useGetCardList 훅 리팩토링 frontend/src/hooks/queries/club/useGetCardList.ts |
UseGetCardListProps 인터페이스 도입. 함수 서명을 개별 매개변수에서 객체 구조로 변경. queryKey 및 API 호출 인자 순서를 division-category에서 category-division으로 재정렬. select 변환에서 logo를 convertToDriveUrl로 매핑하여 반환 데이터 형태 개선. |
호출 사이트 업데이트 frontend/src/pages/MainPage/MainPage.tsx |
useGetCardList 호출을 새로운 객체 매개변수 형식으로 변경. searchCategory를 category 필드로 매핑. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10분
- 주의 사항:
- queryKey와 API 호출 인자 순서 변경이 올바르게 일치하는지 확인 (division과 category 순서)
- category 필드 매핑(searchCategory → category)이 모든 호출 사이트에서 일관되게 적용되는지 검증
- convertToDriveUrl을 통한 logo 변환이 예상대로 작동하는지, 실패 케이스 처리가 있는지 확인
- useGetCardList를 사용하는 다른 컴포넌트나 호출 사이트가 있다면 누락된 업데이트가 없는지 확인
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | 제목이 변경사항의 핵심을 명확하게 요약하고 있습니다. useGetCardList 훅의 파라미터를 객체로 변경하는 리팩토링이 주요 변경사항이며, 제목은 이를 정확히 반영하고 있습니다. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✨ 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
refactor/change-parameter-useGetCardList
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
frontend/src/hooks/queries/club/useGetCardList.ts(1 hunks)frontend/src/pages/MainPage/MainPage.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
frontend/**/*.{ts,tsx}
📄 CodeRabbit inference engine (frontend/.cursorrules)
frontend/**/*.{ts,tsx}: Replace magic numbers with named constants for clarity.
Replace complex or nested ternary operators with if/else statements or IIFEs for readability.
Assign complex boolean conditions to named variables.
Use consistent return types for similar functions and hooks.
Avoid hidden side effects; functions should only perform actions implied by their signature (Single Responsibility Principle).
Use unique, descriptive names for custom wrappers and functions to avoid ambiguity.
Define constants near related logic or ensure names link them clearly.
Files:
frontend/src/hooks/queries/club/useGetCardList.tsfrontend/src/pages/MainPage/MainPage.tsx
frontend/**/*.tsx
📄 CodeRabbit inference engine (frontend/.cursorrules)
frontend/**/*.tsx: Abstract complex logic/interactions into dedicated components or higher-order components (HOCs).
Separate significantly different conditional UI/logic into distinct components.
Colocate simple, localized logic or use inline definitions to reduce context switching.
Choose field-level or form-level cohesion based on form requirements.
Break down broad state management into smaller, focused hooks or contexts.
Use component composition instead of props drilling.
Files:
frontend/src/pages/MainPage/MainPage.tsx
🧠 Learnings (5)
📚 Learning: 2025-07-19T05:09:10.702Z
Learnt from: CR
Repo: Moadong/moadong PR: 0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-19T05:09:10.702Z
Learning: Applies to frontend/**/*.{ts,tsx} : Use consistent return types for similar functions and hooks.
Applied to files:
frontend/src/hooks/queries/club/useGetCardList.tsfrontend/src/pages/MainPage/MainPage.tsx
📚 Learning: 2025-05-01T08:32:09.398Z
Learnt from: Due-IT
Repo: Moadong/moadong PR: 329
File: backend/src/main/java/moadong/club/controller/ClubSearchController.java:0-0
Timestamp: 2025-05-01T08:32:09.398Z
Learning: ClubSearchController의 searchClubsByKeyword 메서드와 ClubSearchService의 searchClubsByKeyword 메서드 사이에 파라미터 순서 일치가 중요하다. 현재 컨트롤러의 매개변수 순서는 'keyword, recruitmentStatus, category, division'인 반면, 서비스 메서드의 순서는 'keyword, recruitmentStatus, division, category'이다. 컨트롤러에서 서비스 호출 시 'keyword, recruitmentStatus, division, category' 순서로 전달하면 category와 division 값이 바뀌어 검색 결과가 잘못될 수 있다.
Applied to files:
frontend/src/hooks/queries/club/useGetCardList.tsfrontend/src/pages/MainPage/MainPage.tsx
📚 Learning: 2025-07-19T05:09:10.702Z
Learnt from: CR
Repo: Moadong/moadong PR: 0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-19T05:09:10.702Z
Learning: Applies to frontend/**/*.{ts,tsx} : Replace magic numbers with named constants for clarity.
Applied to files:
frontend/src/pages/MainPage/MainPage.tsx
📚 Learning: 2025-03-19T05:18:07.818Z
Learnt from: seongwon030
Repo: Moadong/moadong PR: 195
File: frontend/src/pages/AdminPage/AdminPage.tsx:7-7
Timestamp: 2025-03-19T05:18:07.818Z
Learning: AdminPage.tsx에서 현재 하드코딩된 클럽 ID('67d2e3b9b15c136c6acbf20b')는 로그인 기능 구현 후 동적으로 가져오는 방식으로 수정될 예정입니다.
Applied to files:
frontend/src/pages/MainPage/MainPage.tsx
📚 Learning: 2025-07-19T05:05:10.196Z
Learnt from: seongwon030
Repo: Moadong/moadong PR: 548
File: frontend/src/pages/ClubDetailPage/ClubDetailPage.tsx:17-57
Timestamp: 2025-07-19T05:05:10.196Z
Learning: ClubDetailPage.tsx에서 notJoinedClubNames 배열의 하드코딩은 의도적인 설계 결정입니다. 개발자가 명시적으로 하드코딩을 선택했으므로 이에 대한 리팩토링 제안을 하지 않아야 합니다.
Applied to files:
frontend/src/pages/MainPage/MainPage.tsx
🧬 Code graph analysis (2)
frontend/src/hooks/queries/club/useGetCardList.ts (2)
frontend/src/types/club.responses.ts (1)
ClubSearchResponse(3-6)frontend/src/apis/getClubList.ts (1)
getClubList(3-30)
frontend/src/pages/MainPage/MainPage.tsx (1)
frontend/src/hooks/queries/club/useGetCardList.ts (1)
useGetCardList(13-28)
🔇 Additional comments (3)
frontend/src/pages/MainPage/MainPage.tsx (1)
31-32: LGTM! 훅 호출이 새로운 객체 파라미터 형식에 맞게 올바르게 업데이트되었습니다.호출 사이트가 새로운
UseGetCardListProps인터페이스에 맞게 정확하게 변경되었으며,searchCategory를category로 올바르게 매핑했습니다.frontend/src/hooks/queries/club/useGetCardList.ts (2)
6-11: LGTM! 인터페이스 정의로 타입 안정성이 향상되었습니다.
UseGetCardListProps인터페이스를 추가하여 훅의 파라미터 구조를 명확하게 정의했습니다. 객체 파라미터 패턴을 사용하면 향후 파라미터 추가 시에도 하위 호환성을 유지하기 쉽습니다.
17-18: 파라미터 순서가 API 시그니처와 일치하도록 수정되어 버그가 해결되었습니다.파라미터 순서를
(keyword, recruitmentStatus, category, division)으로 변경하여getClubListAPI 시그니처와 정확히 일치시켰습니다. 이전 학습 내용에 따르면 category와 division의 순서 불일치로 인해 검색 결과가 잘못될 수 있었는데, 이 변경으로 해당 문제가 해결되었습니다.참고: queryKey 순서 변경으로 인해 기존 React Query 캐시가 모두 무효화됩니다. 사용자는 페이지 접속 시 새롭게 데이터를 불러오게 됩니다. 이것이 의도된 동작인지 확인해 주세요.
Based on learnings
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 @coderabbitai help to get the list of available commands and usage tips.
lepitaaar
left a comment
There was a problem hiding this comment.
객체로 바꿔 순서보장과 컴파일단에서 파라미터 검증을 해주니 좋은것 같네요!
📝작업 내용
중점적으로 리뷰받고 싶은 부분(선택)
논의하고 싶은 부분(선택)
🫡 참고사항
Summary by CodeRabbit
릴리즈 노트
Refactor
Bug Fixes