Skip to content

Commit

Permalink
fix: memoized the course run ids passed to useApplicableCatalogs (#1296)
Browse files Browse the repository at this point in the history
* fix: memoized the course run ids passed to useApplicableCatalogs
* fix: same fix for coupon requests
  • Loading branch information
adamstankiewicz committed Sep 9, 2024
1 parent 1957eff commit f28dc42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand Down Expand Up @@ -92,7 +93,7 @@ export const ApproveLicenseRequestModal = ({
defaultMessage="Approve License Request"
description="Title for the approve license request modal."
/>
)}
)}
isOpen={isOpen}
hasCloseButton
onClose={onClose}
Expand Down

0 comments on commit f28dc42

Please sign in to comment.