From e4d662521c660325b3cf6655f3aa6058e0a3198a Mon Sep 17 00:00:00 2001 From: zielvna Date: Fri, 26 Jan 2024 12:30:56 +0100 Subject: [PATCH] fix position list pagination bugs --- src/components/PositionsList/PositionsList.tsx | 4 ++++ .../WrappedPositionsList/WrappedPositionsList.tsx | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/PositionsList/PositionsList.tsx b/src/components/PositionsList/PositionsList.tsx index eece6edeb..972431156 100644 --- a/src/components/PositionsList/PositionsList.tsx +++ b/src/components/PositionsList/PositionsList.tsx @@ -70,6 +70,10 @@ export const PositionsList: React.FC = ({ setPage(initialPage) }, []) + useEffect(() => { + handleChangePagination(initialPage) + }, [initialPage]) + return ( { dispatch(actions.setLastPage(page)) } + useEffect(() => { + if (lastPage > Math.ceil(list.length / 5)) { + setLastPage(Math.ceil(list.length / 5)) + } + }, [list]) + return (