File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -36,10 +36,10 @@ export function useFilteredProblems() {
3636 const currentPage = useRef ( 1 ) ;
3737
3838 const fetchProblems = useCallback (
39- async ( isLoadingMore = false ) => {
39+ async ( pageNum : number , isLoadingMore = false ) => {
4040 if ( ! isLoadingMore ) {
4141 seenIds . current . clear ( ) ;
42- currentPage . current = 1 ;
42+ currentPage . current = pageNum ;
4343 setIsEmpty ( false ) ;
4444 }
4545
@@ -127,13 +127,13 @@ export function useFilteredProblems() {
127127 } , [ ] ) ;
128128
129129 useEffect ( ( ) => {
130- fetchProblems ( false ) ;
130+ fetchProblems ( 1 , false ) ;
131131 } , [ filters , fetchProblems ] ) ;
132132
133133 const loadMore = useCallback ( ( ) => {
134134 if ( ! isLoading && hasMore ) {
135135 currentPage . current += 1 ;
136- fetchProblems ( true ) ;
136+ fetchProblems ( currentPage . current , true ) ;
137137 }
138138 } , [ isLoading , hasMore , fetchProblems ] ) ;
139139
@@ -146,5 +146,6 @@ export function useFilteredProblems() {
146146 hasMore,
147147 isEmpty,
148148 loadMore,
149+ fetchProblems,
149150 } ;
150151}
You can’t perform that action at this time.
0 commit comments