From 31df58a6aad4005681f5a349dbd93318d74cd87a Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Mon, 9 Sep 2024 18:37:53 -0400 Subject: [PATCH 1/2] fix: memoized the course run ids passed to useApplicableCatalogs --- .../subsidy-request-modals/ApproveLicenseRequestModal.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/subsidy-request-modals/ApproveLicenseRequestModal.jsx b/src/components/subsidy-request-modals/ApproveLicenseRequestModal.jsx index 73095513da..26e7df95c3 100644 --- a/src/components/subsidy-request-modals/ApproveLicenseRequestModal.jsx +++ b/src/components/subsidy-request-modals/ApproveLicenseRequestModal.jsx @@ -28,13 +28,14 @@ export const ApproveLicenseRequestModal = ({ onClose, }) => { const { data: subscriptions } = useContext(SubscriptionContext); + const courseRunIds = useMemo(() => [courseId], [courseId]); const { applicableSubscriptions, isLoading: isLoadingApplicableSubscriptions, error: loadApplicableSubscriptionsError, } = useApplicableSubscriptions({ enterpriseId: enterpriseCustomerUUID, - courseRunIds: [courseId], + courseRunIds, subscriptions, }); @@ -92,7 +93,7 @@ export const ApproveLicenseRequestModal = ({ defaultMessage="Approve License Request" description="Title for the approve license request modal." /> -)} + )} isOpen={isOpen} hasCloseButton onClose={onClose} From 8f9f492c50daf9264429414acfdc2f34dc299b41 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Mon, 9 Sep 2024 18:41:08 -0400 Subject: [PATCH 2/2] fix: same fix for coupon requests --- .../subsidy-request-modals/ApproveCouponCodeRequestModal.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/subsidy-request-modals/ApproveCouponCodeRequestModal.jsx b/src/components/subsidy-request-modals/ApproveCouponCodeRequestModal.jsx index 5c40b0dac2..15dfc404f3 100644 --- a/src/components/subsidy-request-modals/ApproveCouponCodeRequestModal.jsx +++ b/src/components/subsidy-request-modals/ApproveCouponCodeRequestModal.jsx @@ -28,13 +28,14 @@ export const ApproveCouponCodeRequestModal = ({ onSuccess, onClose, }) => { + const courseRunIds = useMemo(() => [courseId], [courseId]); const { applicableCoupons, isLoading: isLoadingApplicableCoupons, error: loadApplicableCouponsError, } = useApplicableCoupons({ enterpriseId: enterpriseCustomerUUID, - courseRunIds: [courseId], + courseRunIds, coupons, }); const [selectedCouponId, setSelectedCouponId] = useState();