Skip to content

Commit

Permalink
fix(pagination): duplicate first page button [skip-cd] (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonghauhive authored Jul 24, 2024
2 parents 01e85dd + 2caa231 commit 92608a2
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 92608a2

Please sign in to comment.