-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 'Display Items' dropdown in
PaginatedTable
change not working (#…
…488) * fix(web): fix 'Displayed items' dropdown in PaginatedTable * chore(web): update changeset
- Loading branch information
Showing
2 changed files
with
9 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@blobscan/web": patch | ||
--- | ||
|
||
Fixed 'Displayed Items' dropdown in PaginedTable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; | ||
} |