Skip to content

Commit

Permalink
feat: omit default values from searchParams
Browse files Browse the repository at this point in the history
  • Loading branch information
nmcharlton committed Jan 30, 2023
1 parent 96d02f5 commit 6d890bf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/context/CapturesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ export function CapturesProvider(props) {

useEffect(() => {
handleQuerySearchParams({
rowsPerPage,
page,
order,
orderBy,
rowsPerPage:
rowsPerPage === DEFAULT_ROWS_PER_PAGE ? undefined : rowsPerPage,
page: page === DEFAULT_PAGE ? undefined : page,
order: order === DEFAULT_ORDER ? undefined : order,
orderBy: porderByage === DEFAULT_ORDER_BY ? undefined : orderBy,
...filter.toSearchParams(),
});

Expand Down
5 changes: 3 additions & 2 deletions src/context/GrowerContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ export function GrowerProvider(props) {
useEffect(() => {
if (searchParams) {
handleQuerySearchParams({
pageSize,
currentPage,
pageSize: pageSize === DEFAULT_PAGE_SIZE ? undefined : pageSize,
currentPage:
currentPage === DEFAULT_CURRENT_PAGE ? undefined : currentPage,
...filter.toSearchParams(),
});
}
Expand Down
5 changes: 3 additions & 2 deletions src/context/VerifyContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ export function VerifyProvider(props) {
useEffect(() => {
if (searchParams) {
handleQuerySearchParams({
pageSize,
currentPage,
pageSize: pageSize === DEFAULT_PAGE_SIZE ? undefined : pageSize,
currentPage:
currentPage === DEFAULT_CURRENT_PAGE ? undefined : currentPage,
...filter.toSearchParams(),
});
}
Expand Down

0 comments on commit 6d890bf

Please sign in to comment.