From 01b12d7e9d3edb95006e0943836c67a8f78e23f1 Mon Sep 17 00:00:00 2001 From: MaxOvs19 Date: Tue, 5 Dec 2023 19:29:03 +0300 Subject: [PATCH] Fixed pagination --- src/components/AllTaskTableTracker/AllTaskTableTracker.jsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/AllTaskTableTracker/AllTaskTableTracker.jsx b/src/components/AllTaskTableTracker/AllTaskTableTracker.jsx index 9455702f..e2ba3539 100644 --- a/src/components/AllTaskTableTracker/AllTaskTableTracker.jsx +++ b/src/components/AllTaskTableTracker/AllTaskTableTracker.jsx @@ -227,12 +227,11 @@ const AllTaskTableTracker = ({ filteredAllTasks, projects, loader }) => { useEffect(() => { setItems(filteredAllTasks); + const endOffset = itemOffset + itemsPerPage; + setCurrentItems(filteredAllTasks.slice(itemOffset, endOffset)); + setPageCount(Math.ceil(filteredAllTasks.length / itemsPerPage)); }, [filteredAllTasks]); - // Баг с отрисовкой массив currentItems пустой - console.log(currentItems); - console.log(items); - useEffect(() => { const endOffset = itemOffset + itemsPerPage; setCurrentItems(items.slice(itemOffset, endOffset));