Conversation
- 검색 시 카테고리 필터 무시하고 전체 동아리에서 검색 - SearchContext에 isSearching 상태 추가 - 검색과 카테고리 필터링 로직 분리
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Warning
|
| Cohort / File(s) | Change Summary |
|---|---|
검색 상태 및 컨텍스트 확장frontend/src/context/SearchContext.tsx |
isSearching 및 setIsSearching 상태를 컨텍스트에 추가하여 전역적으로 검색 여부를 관리하도록 수정 |
검색 박스 동작 개선frontend/src/components/common/SearchBox/SearchBox.tsx |
검색 시 카테고리를 'all'로 리셋하고, isSearching을 true로 설정하도록 로직 수정 및 관련 훅 사용 |
카테고리 버튼 동작 개선frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.tsx |
카테고리 클릭 시 검색어와 입력값 초기화 후 isSearching을 false로 설정하는 로직 추가 |
메인 페이지 검색 제어 흐름 변경frontend/src/pages/MainPage/MainPage.tsx |
검색 중일 때 카테고리를 'all'로 강제 지정하여 카드 리스트를 전체 동아리 기준으로 불러오도록 로직 수정 |
Sequence Diagram(s)
sequenceDiagram
participant User
participant SearchBox
participant SearchContext
participant MainPage
participant CardList
User->>SearchBox: 검색어 입력 후 검색 실행
SearchBox->>SearchContext: setKeyword(검색어), setIsSearching(true), setSelectedCategory('all')
MainPage->>SearchContext: isSearching, keyword, selectedCategory 조회
MainPage->>CardList: useGetCardList('all', keyword) 호출 (isSearching=true)
CardList-->>MainPage: 전체 동아리 기준 검색 결과 반환
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~15 minutes
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| 검색 시 전체 동아리 기준으로 검색된다 (MOA-130) | ✅ |
Assessment against linked issues: Out-of-scope changes
(해당 사항 없음)
Possibly related PRs
- [feature] 카테고리 선택 상태 Context 전역 관리로 변경 및 페이지 이동 시 상태 유지 #512: 카테고리 전역 상태 관리 도입과 관련된 PR로, 본 PR에서
useCategory와 전역 검색 상태를 통합하는 흐름과 직접적으로 연결됨.
Suggested labels
✨ Feature, 💻 FE
Note
⚡️ Unit Test Generation is now available in beta!
Learn more here, or try it out under "Finishing Touches" below.
✨ Finishing Touches
- 📝 Generate Docstrings
🧪 Generate unit tests
- Create PR with unit tests
- Post copyable unit tests in a comment
- Commit unit tests in branch
feature/#615-search-all-clubs-MOA-130
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.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Explain this complex logic.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai generate unit teststo generate unit tests for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
frontend/src/pages/MainPage/MainPage.tsx (1)
27-27: 매직 문자열을 명명된 상수로 대체하는 것을 고려해보세요.검색 로직은 올바르게 구현되었지만,
'all'매직 문자열을 명명된 상수로 대체하면 가독성과 유지보수성이 향상됩니다.+const ALL_CATEGORIES = 'all'; + const MainPage = () => { // ... other code - const searchCategory = isSearching ? 'all' : selectedCategory; + const searchCategory = isSearching ? ALL_CATEGORIES : selectedCategory;frontend/src/components/common/SearchBox/SearchBox.tsx (1)
28-29: 검색 실행 시 상태 설정이 적절히 구현되었습니다.검색 실행 시 카테고리를 'all'로 설정하고 검색 상태를 활성화하는 로직이 올바르게 구현되어 다른 컴포넌트들과 잘 협조합니다.
전체 애플리케이션에서 일관성을 위해
'all'매직 문자열을 공통 상수로 추출하는 것을 고려해보세요:// constants/categories.ts export const ALL_CATEGORIES = 'all';
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
frontend/src/components/common/SearchBox/SearchBox.tsx(4 hunks)frontend/src/context/SearchContext.tsx(3 hunks)frontend/src/pages/MainPage/MainPage.tsx(1 hunks)frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.tsx(2 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/pages/MainPage/components/CategoryButtonList/CategoryButtonList.tsxfrontend/src/pages/MainPage/MainPage.tsxfrontend/src/components/common/SearchBox/SearchBox.tsxfrontend/src/context/SearchContext.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/components/CategoryButtonList/CategoryButtonList.tsxfrontend/src/pages/MainPage/MainPage.tsxfrontend/src/components/common/SearchBox/SearchBox.tsxfrontend/src/context/SearchContext.tsx
🧠 Learnings (7)
📓 Common learnings
Learnt from: Due-IT
PR: Moadong/moadong#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 값이 바뀌어 검색 결과가 잘못될 수 있다.
📚 Learning: applies to frontend/**/*.{ts,tsx} : use consistent return types for similar functions and hooks....
Learnt from: CR
PR: Moadong/moadong#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/pages/MainPage/components/CategoryButtonList/CategoryButtonList.tsxfrontend/src/pages/MainPage/MainPage.tsxfrontend/src/components/common/SearchBox/SearchBox.tsxfrontend/src/context/SearchContext.tsx
📚 Learning: applies to frontend/**/*.tsx : break down broad state management into smaller, focused hooks or cont...
Learnt from: CR
PR: Moadong/moadong#0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-19T05:09:10.702Z
Learning: Applies to frontend/**/*.tsx : Break down broad state management into smaller, focused hooks or contexts.
Applied to files:
frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.tsxfrontend/src/pages/MainPage/MainPage.tsxfrontend/src/components/common/SearchBox/SearchBox.tsxfrontend/src/context/SearchContext.tsx
📚 Learning: applies to frontend/**/*.tsx : separate significantly different conditional ui/logic into distinct c...
Learnt from: CR
PR: Moadong/moadong#0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-19T05:09:10.702Z
Learning: Applies to frontend/**/*.tsx : Separate significantly different conditional UI/logic into distinct components.
Applied to files:
frontend/src/pages/MainPage/MainPage.tsxfrontend/src/components/common/SearchBox/SearchBox.tsx
📚 Learning: applies to frontend/**/*.tsx : colocate simple, localized logic or use inline definitions to reduce ...
Learnt from: CR
PR: Moadong/moadong#0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-19T05:09:10.702Z
Learning: Applies to frontend/**/*.tsx : Colocate simple, localized logic or use inline definitions to reduce context switching.
Applied to files:
frontend/src/pages/MainPage/MainPage.tsxfrontend/src/components/common/SearchBox/SearchBox.tsxfrontend/src/context/SearchContext.tsx
📚 Learning: applies to frontend/**/*.tsx : abstract complex logic/interactions into dedicated components or high...
Learnt from: CR
PR: Moadong/moadong#0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-19T05:09:10.702Z
Learning: Applies to frontend/**/*.tsx : Abstract complex logic/interactions into dedicated components or higher-order components (HOCs).
Applied to files:
frontend/src/pages/MainPage/MainPage.tsxfrontend/src/components/common/SearchBox/SearchBox.tsx
📚 Learning: clubsearchcontroller의 searchclubsbykeyword 메서드와 clubsearchservice의 searchclubsbykeyword 메서드 사이에 파라미터...
Learnt from: Due-IT
PR: Moadong/moadong#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/pages/MainPage/MainPage.tsx
🔇 Additional comments (4)
frontend/src/context/SearchContext.tsx (1)
8-9: 검색 상태 관리가 적절히 구현되었습니다.
isSearching상태와 setter가 일관된 타입과 네이밍 컨벤션으로 추가되었으며, 기존 컨텍스트 패턴을 잘 따르고 있습니다.Also applies to: 21-21, 30-31
frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.tsx (1)
61-61: 카테고리 클릭 시 검색 상태 초기화가 올바르게 구현되었습니다.카테고리 버튼 클릭 시 검색 키워드와 입력값을 지운 후 검색 상태를
false로 설정하는 순서가 적절하며, 검색 모드에서 카테고리 브라우징 모드로의 전환이 명확합니다.Also applies to: 74-74
frontend/src/pages/MainPage/MainPage.tsx (1)
24-24: 검색 시 전체 동아리 기준 로직이 올바르게 구현되었습니다.
isSearching상태에 따라 검색 카테고리를 동적으로 결정하는 로직이 PR 목표를 정확히 달성하고 있습니다. 검색 시에는 선택된 카테고리와 무관하게 전체 동아리를 대상으로 검색됩니다.Also applies to: 33-33
frontend/src/components/common/SearchBox/SearchBox.tsx (1)
3-3: 카테고리 컨텍스트 의존성이 적절히 추가되었습니다.검색 실행 시 카테고리 상태를 조작하기 위해
useCategory훅이 올바르게 추가되었으며, 검색과 카테고리 상태 간의 조율이 잘 구현되었습니다.Also applies to: 12-12
#️⃣연관된 이슈
📝작업 내용
2025-08-03.01.51.34.mov
중점적으로 리뷰받고 싶은 부분(선택)
논의하고 싶은 부분(선택)
🫡 참고사항
Summary by CodeRabbit
신규 기능
버그 수정
스타일