Skip to content

Commit

Permalink
fix(payment): tvod offer not showing in AuthVOD platform
Browse files Browse the repository at this point in the history
  • Loading branch information
royschut authored and ChristiaanScheermeijer committed Feb 7, 2024
1 parent ca71f29 commit d01d1b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/hooks-react/src/useOffers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const useOffers = () => {
const hasMultipleOfferTypes = !hasPremierOffers && !!mediaOffers?.length && !!svodOfferIds.length;
const offerIds: string[] = mergeOfferIds(mediaOffers || [], svodOfferIds);

const [offerType, setOfferType] = useState<OfferType>(hasPremierOffers || !svodOfferIds ? 'tvod' : 'svod');
const [offerType, setOfferType] = useState<OfferType>(hasPremierOffers || !svodOfferIds.length ? 'tvod' : 'svod');
const updateOfferType = useMemo(() => (hasMultipleOfferTypes ? (type: OfferType) => setOfferType(type) : undefined), [hasMultipleOfferTypes]);

const { data: allOffers, isLoading } = useQuery(['offers', offerIds.join('-')], () => checkoutController.getOffers({ offerIds }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const ChooseOffer = () => {
});

useEffect(() => {
if (!isOfferSwitch) setValue('offerId', defaultOfferId);
if (!isOfferSwitch && !isLoading) setValue('offerId', defaultOfferId);

// Update offerId if the user is switching offers to ensure the correct offer is checked in the ChooseOfferForm
// Initially, a defaultOfferId is set, but when switching offers, we need to use the id of the target offer
Expand Down

0 comments on commit d01d1b7

Please sign in to comment.