@@ -75,6 +75,11 @@ export const ApplicantsList = () => {
7575 const [ currentPage , setCurrentPage ] = useState ( 1 ) ;
7676 const { isOpen, open, close } = useModal ( ) ;
7777
78+ const handleSearchChange = ( keyword : string ) => {
79+ setSearchKeyword ( keyword ) ;
80+ setCurrentPage ( 1 ) ;
81+ } ;
82+
7883 const handleCheckBoxChange = <
7984 G extends FilterGroupType ,
8085 K extends keyof ( typeof filters ) [ G ]
@@ -187,7 +192,26 @@ export const ApplicantsList = () => {
187192 return filtered . sort ( ( a , b ) => a . receiptCode - b . receiptCode ) ;
188193 } , [ applicantsList , searchKeyword , filters ] ) ;
189194
190- const totalPage = data ?. data . totalPages ?? 1 ;
195+ // 검색이나 클라이언트 필터가 있으면 클라이언트 사이드 페이지네이션, 아니면 서버 페이지네이션
196+ const hasClientFilters =
197+ searchKeyword ||
198+ Object . values ( filters . admission ) . some ( v => v ) ||
199+ Object . values ( filters . education ) . some ( v => v ) ||
200+ filters . status . received ;
201+
202+ const totalPage = hasClientFilters
203+ ? Math . max ( 1 , Math . ceil ( filteredApplicants . length / 20 ) )
204+ : ( data ?. data . totalPages ?? 1 ) ;
205+
206+ // 클라이언트 필터가 있으면 페이지별로 데이터 자르기
207+ const paginatedApplicants = useMemo ( ( ) => {
208+ if ( hasClientFilters ) {
209+ const startIndex = ( currentPage - 1 ) * 20 ;
210+ const endIndex = startIndex + 20 ;
211+ return filteredApplicants . slice ( startIndex , endIndex ) ;
212+ }
213+ return filteredApplicants ;
214+ } , [ filteredApplicants , currentPage , hasClientFilters ] ) ;
191215
192216 const handlePageChange = ( page : number ) => {
193217 setCurrentPage ( page ) ;
@@ -196,7 +220,7 @@ export const ApplicantsList = () => {
196220 return (
197221 < Container >
198222 < HeadContent >
199- < FindApplicantInput onSearch = { setSearchKeyword } />
223+ < FindApplicantInput onSearch = { handleSearchChange } />
200224 < ButtonContiner >
201225 < Button
202226 color = { colors . extra . realWhite }
@@ -299,10 +323,10 @@ export const ApplicantsList = () => {
299323 < ApplicantsAllList >
300324 { isLoading ? (
301325 < LoadingContent > 지원자 조회 데이터 기다리는 중...</ LoadingContent >
302- ) : filteredApplicants . length === 0 ? (
326+ ) : paginatedApplicants . length === 0 ? (
303327 < LoadingContent > 지원자 내역이 없습니다.</ LoadingContent >
304328 ) : (
305- filteredApplicants . map ( ( applicant ) => (
329+ paginatedApplicants . map ( ( applicant ) => (
306330 < Applicant
307331 key = { applicant . applicationId }
308332 applicationId = { applicant . applicationId }
0 commit comments