added pagination inside infra list
This commit is contained in:
parent
d615f6ca8a
commit
8a3228c0c1
@ -28,7 +28,11 @@ const ProjectsDisplay = ({
|
|||||||
|
|
||||||
const [projectList, setProjectList] = useState([]);
|
const [projectList, setProjectList] = useState([]);
|
||||||
const debouncedSearch = useDebounce(searchTerm, 500);
|
const debouncedSearch = useDebounce(searchTerm, 500);
|
||||||
const { data, isLoading, isError, error } = useProjects(ITEMS_PER_PAGE, 1, debouncedSearch);
|
const { data, isLoading, isError, error } = useProjects(
|
||||||
|
ITEMS_PER_PAGE,
|
||||||
|
currentPage,
|
||||||
|
debouncedSearch
|
||||||
|
);
|
||||||
|
|
||||||
const filteredProjects =
|
const filteredProjects =
|
||||||
data?.data?.filter((project) => {
|
data?.data?.filter((project) => {
|
||||||
@ -81,6 +85,12 @@ const ProjectsDisplay = ({
|
|||||||
}
|
}
|
||||||
}, [data?.data, isLoading, selectedStatuses]);
|
}, [data?.data, isLoading, selectedStatuses]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (debouncedSearch) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
}
|
||||||
|
}, [debouncedSearch]);
|
||||||
|
|
||||||
if (isLoading)
|
if (isLoading)
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user