-
Notifications
You must be signed in to change notification settings - Fork 3
[feature] 검색 결과 개수를 표시한다 #789
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
Changes from all commits
8cf9801
45ccbee
ad12932
a829394
cb6cbee
af66dc3
0f1b738
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,7 +18,6 @@ const MainPage = () => { | |||||||||||||
| useTrackPageView('MainPage'); | ||||||||||||||
|
|
||||||||||||||
| const { selectedCategory } = useSelectedCategory(); | ||||||||||||||
|
|
||||||||||||||
| const { keyword } = useSearchKeyword(); | ||||||||||||||
| const { isSearching } = useSearchIsSearching(); | ||||||||||||||
| const recruitmentStatus = 'all'; | ||||||||||||||
|
|
@@ -29,13 +28,14 @@ const MainPage = () => { | |||||||||||||
| // TODO: 추후 확정되면 DivisionKey(중동/가동/과동) 같은 타입을 | ||||||||||||||
| // types/club.ts에 정의해서 tabs 관리하도록 리팩터링하기 | ||||||||||||||
|
|
||||||||||||||
| const { | ||||||||||||||
| data: clubs, | ||||||||||||||
| error, | ||||||||||||||
| isLoading, | ||||||||||||||
| } = useGetCardList(keyword, recruitmentStatus, division, searchCategory); | ||||||||||||||
| const isEmpty = !isLoading && (!clubs || clubs.length === 0); | ||||||||||||||
| const hasData = clubs && clubs.length > 0; | ||||||||||||||
| const { data, error, isLoading } = | ||||||||||||||
| useGetCardList(keyword, recruitmentStatus, division, searchCategory); | ||||||||||||||
|
Comment on lines
+31
to
+32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 파라미터 순서 오류로 인해 검색 결과가 잘못될 수 있습니다.
다음과 같이 파라미터 순서를 수정하세요: const { data, error, isLoading } =
- useGetCardList(keyword, recruitmentStatus, division, searchCategory);
+ useGetCardList(keyword, recruitmentStatus, searchCategory, division);🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| const clubs = data?.clubs || []; | ||||||||||||||
| const totalCount = data?.totalCount || 0; | ||||||||||||||
|
|
||||||||||||||
| const isEmpty = !isLoading && totalCount === 0; | ||||||||||||||
| const hasData = totalCount > 0; | ||||||||||||||
|
|
||||||||||||||
| const clubList = useMemo(() => { | ||||||||||||||
| if (!hasData) return null; | ||||||||||||||
|
|
@@ -55,14 +55,21 @@ const MainPage = () => { | |||||||||||||
| /> | ||||||||||||||
| <Styled.PageContainer> | ||||||||||||||
| <CategoryButtonList /> | ||||||||||||||
| <Styled.SectionTabs> | ||||||||||||||
|
|
||||||||||||||
| <Styled.SectionBar> | ||||||||||||||
| <Styled.SectionTabs> | ||||||||||||||
| {tabs | ||||||||||||||
| .map((tab) =>( | ||||||||||||||
| <Styled.Tab key={tab} $active={active===tab} onClick={() => setActive(tab)}> | ||||||||||||||
| {tab} | ||||||||||||||
| </Styled.Tab> | ||||||||||||||
| ))} | ||||||||||||||
| </Styled.SectionTabs> | ||||||||||||||
| <Styled.TotalCountResult role="status"> | ||||||||||||||
| {`전체 ${isLoading ? 0 : totalCount}개의 동아리`} | ||||||||||||||
| </Styled.TotalCountResult> | ||||||||||||||
|
Comment on lines
+68
to
+70
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 로딩 중 "0개"를 표시하면 사용자에게 혼란을 줄 수 있습니다. 로딩 중일 때 "전체 0개의 동아리"를 표시하는 것은 실제로 결과가 없는 것처럼 보일 수 있습니다. 로딩 중에는 개수를 표시하지 않거나 로딩 인디케이터를 표시하는 것이 더 나은 UX를 제공할 수 있습니다. 다음과 같이 수정하는 것을 고려해보세요: <Styled.TotalCountResult role="status">
- {`전체 ${isLoading ? 0 : totalCount}개의 동아리`}
+ {isLoading ? '검색 중...' : `전체 ${totalCount}개의 동아리`}
</Styled.TotalCountResult>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| </Styled.SectionBar> | ||||||||||||||
|
|
||||||||||||||
| <Styled.ContentWrapper> | ||||||||||||||
| {isLoading ? ( | ||||||||||||||
| <Spinner /> | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import type { Club } from './club'; | ||
|
|
||
| export interface ClubSearchResponse { | ||
| clubs: Club[]; | ||
| totalCount: number; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파라미터 순서 오류로 인한 검색 결과 오류가 발생합니다.
getClubList함수 호출 시division과category파라미터의 순서가 바뀌어 있습니다. API 함수의 시그니처는getClubList(keyword, recruitmentStatus, category, division)순서를 기대하지만, 현재 코드는division과category를 반대로 전달하고 있습니다. 이로 인해 검색 필터가 올바르게 작동하지 않습니다.다음 diff를 적용하여 파라미터 순서를 수정하세요:
return useQuery<ClubSearchResponse, unknown, ClubSearchResponse>({ - queryKey: ['clubs', keyword, recruitmentStatus, division, category], - queryFn: () => getClubList(keyword, recruitmentStatus, division, category), + queryKey: ['clubs', keyword, recruitmentStatus, category, division], + queryFn: () => getClubList(keyword, recruitmentStatus, category, division), placeholderData: keepPreviousData,📝 Committable suggestion
🤖 Prompt for AI Agents