fix: 검색 모드에서 카테고리 필터링 적용
- 검색 결과에도 selectedCategories로 필터링 추가 - Schedule.jsx, AdminSchedule.jsx 수정
This commit is contained in:
parent
bedda590eb
commit
9986b918d8
2 changed files with 7 additions and 2 deletions
|
|
@ -519,7 +519,10 @@ function AdminSchedule() {
|
|||
// 일정 목록 (검색 모드일 때 searchResults, 일반 모드일 때 로컬 필터링) - useMemo로 최적화
|
||||
const filteredSchedules = useMemo(() => {
|
||||
if (isSearchMode) {
|
||||
return searchTerm ? searchResults : [];
|
||||
if (!searchTerm) return [];
|
||||
// 카테고리 필터링 적용
|
||||
if (selectedCategories.length === 0) return searchResults;
|
||||
return searchResults.filter(s => selectedCategories.includes(s.category_id));
|
||||
}
|
||||
// 일반 모드: 로컬 필터링
|
||||
return schedules.filter(schedule => {
|
||||
|
|
|
|||
|
|
@ -259,7 +259,9 @@ function Schedule() {
|
|||
if (isSearchMode) {
|
||||
// 검색 전엔 빈 목록, 검색 후엔 API 결과 (Meilisearch 유사도순 유지)
|
||||
if (!searchTerm) return [];
|
||||
return searchResults;
|
||||
// 카테고리 필터링 적용
|
||||
if (selectedCategories.length === 0) return searchResults;
|
||||
return searchResults.filter(s => selectedCategories.includes(s.category_id));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue