1
0
mirror of https://github.com/barthuijgen/factorio-sites.git synced 2025-03-04 15:51:24 +02:00

fix: prevent pagination redirect for same url

This commit is contained in:
Bart 2021-04-13 10:50:23 +02:00
parent bc86109e8a
commit 6984d97adf

View File

@ -19,6 +19,10 @@ export const Pagination: React.FC<BoxProps & PaginationProps> = ({
const router = useRouter();
const handlePageChange = ({ selected }: { selected: number }) => {
if ((router.query.page || "1") === String(selected + 1)) {
return;
}
const query: Record<string, string> = { ...router.query, page: String(selected + 1) };
const href = `/?${Object.keys(query)
.map((key) => `${key}=${query[key]}`)