Skip to content

Commit c3665ac

Browse files
committed
Fix admin page
1 parent 49e6c5c commit c3665ac

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

peerprep-fe/src/hooks/useFilteredProblems.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)