diff --git a/packages/booking-flow/lib/components/SelectRate/RoomsContainer/index.tsx b/packages/booking-flow/lib/components/SelectRate/RoomsContainer/index.tsx index 7e8070c2b..4c4a0a894 100644 --- a/packages/booking-flow/lib/components/SelectRate/RoomsContainer/index.tsx +++ b/packages/booking-flow/lib/components/SelectRate/RoomsContainer/index.tsx @@ -31,18 +31,20 @@ export function RoomsContainer({}: RoomsContainerProps) { } = useSelectRateContext() useEffect(() => { - if (availabilityData) { - const lowestRoomPrice = getLowestRoomPrice() - const booking = inputData?.booking! + if (!availabilityData) return - trackLowestRoomPrice({ - hotelId: booking.hotelId, - arrivalDate: booking?.fromDate, - departureDate: booking?.toDate, - lowestPrice: lowestRoomPrice.price.toString(), - currency: lowestRoomPrice.currency, - }) - } + const lowestRoomPrice = getLowestRoomPrice() + const booking = inputData?.booking + + if (!booking) return + + trackLowestRoomPrice({ + hotelId: booking.hotelId, + arrivalDate: booking?.fromDate, + departureDate: booking?.toDate, + lowestPrice: lowestRoomPrice.price.toString(), + currency: lowestRoomPrice.currency, + }) }, [availabilityData, inputData, getLowestRoomPrice]) if (isFetching) {