File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -168,12 +168,16 @@ const Page = () => {
168168 await fetchAndCalculate ( user . uid ) ;
169169
170170 // 페이지 조절
171+ const newFilteredLength = fetchedPlans . filter ( ( plan ) =>
172+ plan . title . toLowerCase ( ) . includes ( searchQuery . toLowerCase ( ) )
173+ ) . length ;
174+
171175 if (
172- currentPage > Math . ceil ( ( plans . length - 1 ) / itemsPerPage ) &&
173- Math . ceil ( ( plans . length - 1 ) / itemsPerPage ) > 0
176+ currentPage > Math . ceil ( newFilteredLength / itemsPerPage ) &&
177+ Math . ceil ( newFilteredLength / itemsPerPage ) > 0
174178 ) {
175- setCurrentPage ( Math . ceil ( ( plans . length - 1 ) / itemsPerPage ) ) ;
176- } else if ( Math . ceil ( ( plans . length - 1 ) / itemsPerPage ) === 0 ) {
179+ setCurrentPage ( Math . ceil ( newFilteredLength / itemsPerPage ) ) ;
180+ } else if ( Math . ceil ( newFilteredLength / itemsPerPage ) === 0 ) {
177181 setCurrentPage ( 1 ) ;
178182 }
179183 } catch ( err ) {
You can’t perform that action at this time.
0 commit comments