Skip to content

Commit

Permalink
fix(pagination): duplicate first page button
Browse files Browse the repository at this point in the history
  • Loading branch information
tonghauhive committed Jul 18, 2024
1 parent c1caeed commit 2caa231
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ export const Pagination: React.FC<PaginationProps> = ({
};

const renderFirstPage = () => {
const sanitizeStartPage = currentPage - Math.floor(sanitizeLimit / 2);
let sanitizeStartPage = currentPage - Math.floor(sanitizeLimit / 2);

if (pages.length - sanitizeStartPage < limit) {
sanitizeStartPage = pages.length + 1 - limit;
}

if (sanitizeStartPage > 1) {
return (
Expand Down

0 comments on commit 2caa231

Please sign in to comment.