diff --git a/src/CAREUI/misc/PaginatedList.tsx b/src/CAREUI/misc/PaginatedList.tsx index 6bc0c08f843..3b68b23bd30 100644 --- a/src/CAREUI/misc/PaginatedList.tsx +++ b/src/CAREUI/misc/PaginatedList.tsx @@ -33,6 +33,7 @@ function useContextualized() { interface Props extends QueryOptions> { route: QueryRoute>; perPage?: number; + initialPage?: number; onPageChange?: (page: number) => void; queryCB?: ( query: ReturnType>>, @@ -50,7 +51,7 @@ export default function PaginatedList({ queryCB, ...queryOptions }: Props) { - const [currentPage, _setPage] = useState(1); + const [currentPage, _setPage] = useState(queryOptions.initialPage ?? 1); const setPage = (page: number) => { _setPage(page); diff --git a/src/Components/Facility/DischargedPatientsList.tsx b/src/Components/Facility/DischargedPatientsList.tsx index 1f789a158c8..47e5cd5a68d 100644 --- a/src/Components/Facility/DischargedPatientsList.tsx +++ b/src/Components/Facility/DischargedPatientsList.tsx @@ -436,6 +436,7 @@ const DischargedPatientsList = ({ pathParams={{ facility_external_id }} query={{ ordering: "-modified_date", ...qParams }} queryCB={(query) => setCount(query.data?.count || 0)} + initialPage={qParams.page} onPageChange={updatePage} > {() => (