Skip to content

Commit

Permalink
fix: 'Display Items' dropdown in PaginatedTable change not working (#…
Browse files Browse the repository at this point in the history
…488)

* fix(web): fix 'Displayed items' dropdown in PaginatedTable

* chore(web): update changeset
  • Loading branch information
xFJA authored Aug 25, 2024
1 parent 6f1a448 commit 7e49c8b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
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 };
}

0 comments on commit 7e49c8b

Please sign in to comment.