Skip to content

Commit

Permalink
fix discontinue refetch not invoked
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Nov 6, 2023
1 parent c6f8fb2 commit 6cfd3e0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Components/Medicine/MedicineAdministrationSheet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ const MedicineAdministrationSheet = ({ readonly, is_prn }: Props) => {
}
);

const discontinuedCount = useQuery(MedicineRoutes.listPrescriptions, {
const discontinuedPrescriptions = useQuery(MedicineRoutes.listPrescriptions, {
pathParams: { consultation },
query: { ...filters, discontinued: true },
prefetch: !showDiscontinued,
}).data?.count;
});

const discontinuedCount = discontinuedPrescriptions.data?.count;

const { activityTimelineBounds, prescriptions } = useMemo(
() => ({
Expand Down Expand Up @@ -113,7 +115,10 @@ const MedicineAdministrationSheet = ({ readonly, is_prn }: Props) => {
<MedicineAdministrationTable
prescriptions={prescriptions}
pagination={pagination}
onRefetch={refetch}
onRefetch={() => {
refetch();
discontinuedPrescriptions.refetch();
}}
/>
)}

Expand Down

0 comments on commit 6cfd3e0

Please sign in to comment.