Skip to content

Commit

Permalink
Merge branch 'main' into fix-e2e-screenshot-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagofilipenunes authored Sep 9, 2024
2 parents 4ff563f + fa1802d commit 9fb9603
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 6 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/components/activity/ActivityProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ type ParamsKey = Extract<keyof QueryActivityParams, string>;
export const ActivityProvider: FC<Props> = ({ children, params }) => {
const nav = useNavigate();
const searchParams: ActivitySearchParams = useSearch({ strict: false });
const limit = searchParams.limit ?? 10;
const offset = searchParams.offset ?? 0;
const limit = searchParams.limit;
const offset = searchParams.offset;

const queryParams = getQueryParams(params, searchParams);
// Query the list
Expand Down
19 changes: 15 additions & 4 deletions src/components/activity/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
SearchParamsValidator,
validArrayOf,
validLiteral,
validNumberType,
validNumber,
validString,
validateSearchParams,
} from 'libs/routing/utils';
Expand Down Expand Up @@ -45,10 +45,21 @@ export const activityValidators: SearchParamsValidator<ActivitySearchParams> = {
pairs: validArrayOf(validString),
start: validString,
end: validString,
limit: validNumberType,
offset: validNumberType,
limit: validNumber,
offset: validNumber,
};
export const validateActivityParams = (
search: Record<string, string>
): ActivitySearchParams => {
const rawSearch = validateSearchParams(activityValidators)(search);
const limit = Number(rawSearch.limit ?? 10);
const offset = Number(rawSearch.offset ?? 0);
return {
...rawSearch,
limit,
offset,
};
};
export const validateActivityParams = validateSearchParams(activityValidators);

export const activityHasPairs = (activity: Activity, pairs: string[] = []) => {
if (pairs.length === 0) return true;
Expand Down

0 comments on commit 9fb9603

Please sign in to comment.