Add index to key for uniqueness (#640)

Using only the page as a key does not preserve uniqueness across updates. This caused, for example, an ellipsis to appear before the pagination elements when navigating from a page in the middle back to the first page.
This commit is contained in:
howiesommerfeld
2024-06-24 01:00:24 +02:00
committed by GitHub
parent fe35ffe0be
commit 8022bb32a2

View File

@@ -38,7 +38,7 @@ export default function Pagination({ totalPages }: { totalPages: number }) {
return (
<PaginationNumber
key={page}
key={`${page}-${index}`}
href={createPageURL(page)}
page={page}
position={position}