diff --git a/src/components/ui/paginator.tsx b/src/components/ui/paginator.tsx index 604a6414..61ca40fa 100644 --- a/src/components/ui/paginator.tsx +++ b/src/components/ui/paginator.tsx @@ -18,6 +18,10 @@ export const PaginationPages = ({ baseUrl: string; }) => { const setQueryParams = useSetQueryParams(); + + if (currentPage > totalPages) { + setQueryParams({ page: '1' }); + } function paginationHandler(page: number) { setQueryParams({ page: page.toString() }); } diff --git a/src/layouts/job-filters.tsx b/src/layouts/job-filters.tsx index 8df89cc2..d95f3769 100644 --- a/src/layouts/job-filters.tsx +++ b/src/layouts/job-filters.tsx @@ -26,12 +26,14 @@ import { ScrollArea } from '@/components/ui/scroll-area'; import { cn } from '@/lib/utils'; import useSetQueryParams from '@/hooks/useSetQueryParams'; import { useEffect } from 'react'; +import { DEFAULT_PAGE } from '@/config/app.config'; const JobFilters = ({ searchParams }: { searchParams: JobQuerySchemaType }) => { const setQueryParams = useSetQueryParams(); const form = useForm({ resolver: zodResolver(JobQuerySchema), defaultValues: { + page: DEFAULT_PAGE, workmode: searchParams.workmode, salaryrange: searchParams.salaryrange, location: searchParams.location,