Skip to content

Commit

Permalink
fix(pagination): updating lastPage variable correctly for table layout (
Browse files Browse the repository at this point in the history
#1151)

fix(pagination): updating lastPage variable to currPage+4 when layout is table for firstpage var fix

The page number was not showing correctly on firsrt few clicks because lastPage variable was not
updating on first few clicks when layout is table due to incorrect	addition. Was working correctly
when layout is pagination.

fix #1150
  • Loading branch information
rajatpandey441 authored Nov 26, 2023
1 parent 73993e9 commit 2259bf5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const PaginationComponent: FC<PaginationProps> = ({
}) => {
const theme = mergeDeep(getTheme().pagination, customTheme);

const lastPage = Math.min(Math.max(currentPage + 2, 5), totalPages);
const lastPage = Math.min(Math.max(layout === 'pagination' ? currentPage + 2 : currentPage + 4, 5), totalPages);
const firstPage = Math.max(1, lastPage - 4);

const goToNextPage = (): void => {
Expand Down

1 comment on commit 2259bf5

@vercel
Copy link

@vercel vercel bot commented on 2259bf5 Nov 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.