Fixed pagination

This commit is contained in:
MaxOvs19 2023-12-05 19:29:03 +03:00
parent 47a38c45b2
commit 01b12d7e9d

View File

@ -227,12 +227,11 @@ const AllTaskTableTracker = ({ filteredAllTasks, projects, loader }) => {
useEffect(() => { useEffect(() => {
setItems(filteredAllTasks); setItems(filteredAllTasks);
const endOffset = itemOffset + itemsPerPage;
setCurrentItems(filteredAllTasks.slice(itemOffset, endOffset));
setPageCount(Math.ceil(filteredAllTasks.length / itemsPerPage));
}, [filteredAllTasks]); }, [filteredAllTasks]);
// Баг с отрисовкой массив currentItems пустой
console.log(currentItems);
console.log(items);
useEffect(() => { useEffect(() => {
const endOffset = itemOffset + itemsPerPage; const endOffset = itemOffset + itemsPerPage;
setCurrentItems(items.slice(itemOffset, endOffset)); setCurrentItems(items.slice(itemOffset, endOffset));