Skip to content

Commit

Permalink
fix pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
nayr974 committed Dec 19, 2024
1 parent 91c47ca commit 89b1243
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion backend/src/v1/complaint/complaint.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,6 @@ export class ComplaintService {
token?: string,
): Promise<SearchResults> => {
try {
this.logger.error("Searching for complaints");
let results: SearchResults = { totalCount: 0, complaints: [] };

const { orderBy, sortBy, page, pageSize, query, ...filters } = model;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, useRef, useState, useContext, useEffect } from "react";
import { FC, useRef, useState, useContext, useEffect, useCallback } from "react";
import { useAppDispatch, useAppSelector } from "@hooks/hooks";
import COMPLAINT_TYPES from "@apptypes/app/complaint-types";
import {
Expand Down Expand Up @@ -173,10 +173,10 @@ export const ComplaintList: FC<Props> = ({ type, searchQuery }) => {
}
};

const handlePageChange = (page: number) => {
const handlePageChange = useCallback((page: number) => {
setPage(page);
scrollToTop();
};
}, []);

// Scroll to top of table container when paginating
const divRef = useRef<HTMLDivElement>(null);
Expand Down

0 comments on commit 89b1243

Please sign in to comment.