Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 'Display Items' dropdown in PaginatedTable change not working #488

Merged
merged 2 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/seven-gorillas-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blobscan/web": patch
---

Fixed 'Displayed Items' dropdown in PaginedTable
8 changes: 4 additions & 4 deletions apps/web/src/utils/pagination.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { ParsedUrlQuery } from "querystring";

const DEFAULT_PAGE_SIZE = 25;
const DEFAULT_INITIAL_PAGE_SIZE = 25;

export function getPaginationParams(
query: ParsedUrlQuery,
customPageSize?: number
initialPageSize = DEFAULT_INITIAL_PAGE_SIZE
): {
ps: number;
p: number;
} {
const page_ = parseInt(query.p as string);
const pageSize_ = parseInt(query.ps as string);
const page = isNaN(page_) ? 1 : page_;
const pageSize = isNaN(pageSize_) ? DEFAULT_PAGE_SIZE : pageSize_;
const pageSize = isNaN(pageSize_) ? initialPageSize : pageSize_;

return { ps: customPageSize ? customPageSize : pageSize, p: page };
return { ps: pageSize, p: page };
}
Loading