From 6cfd3e0a20cdc9b270086cb7836e7c3564bd995e Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Mon, 6 Nov 2023 17:33:54 +0530 Subject: [PATCH] fix discontinue refetch not invoked --- .../Medicine/MedicineAdministrationSheet/index.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Components/Medicine/MedicineAdministrationSheet/index.tsx b/src/Components/Medicine/MedicineAdministrationSheet/index.tsx index 65fb59799a1..187d5447314 100644 --- a/src/Components/Medicine/MedicineAdministrationSheet/index.tsx +++ b/src/Components/Medicine/MedicineAdministrationSheet/index.tsx @@ -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( () => ({ @@ -113,7 +115,10 @@ const MedicineAdministrationSheet = ({ readonly, is_prn }: Props) => { { + refetch(); + discontinuedPrescriptions.refetch(); + }} /> )}