fix(SW-978) Checks for null data on hotels
This commit is contained in:
@@ -41,18 +41,11 @@ function HotelCard({
|
||||
const { hotelData } = hotel
|
||||
const { price } = hotel
|
||||
|
||||
const amenities = hotelData.detailedFacilities.slice(0, 5)
|
||||
|
||||
const classNames = hotelCardVariants({
|
||||
type,
|
||||
state,
|
||||
})
|
||||
|
||||
const handleMouseEnter = useCallback(() => {
|
||||
if (onHotelCardHover) {
|
||||
if (onHotelCardHover && hotelData) {
|
||||
onHotelCardHover(hotelData.name)
|
||||
}
|
||||
}, [onHotelCardHover, hotelData.name])
|
||||
}, [onHotelCardHover, hotelData])
|
||||
|
||||
const handleMouseLeave = useCallback(() => {
|
||||
if (onHotelCardHover) {
|
||||
@@ -60,6 +53,15 @@ function HotelCard({
|
||||
}
|
||||
}, [onHotelCardHover])
|
||||
|
||||
if (!hotel || !hotelData) return null
|
||||
|
||||
const amenities = hotelData.detailedFacilities.slice(0, 5)
|
||||
|
||||
const classNames = hotelCardVariants({
|
||||
type,
|
||||
state,
|
||||
})
|
||||
|
||||
return (
|
||||
<article
|
||||
className={classNames}
|
||||
@@ -82,8 +84,8 @@ function HotelCard({
|
||||
<section className={styles.hotelInformation}>
|
||||
<div className={styles.titleContainer}>
|
||||
<HotelLogo
|
||||
hotelId={hotel.hotelData.operaId}
|
||||
hotelType={hotel.hotelData.hotelType}
|
||||
hotelId={hotelData.operaId}
|
||||
hotelType={hotelData.hotelType}
|
||||
/>
|
||||
<Subtitle textTransform="capitalize" color="uiTextHighContrast">
|
||||
{hotelData.name}
|
||||
|
||||
Reference in New Issue
Block a user