{hotelData.name}
diff --git a/components/HotelReservation/HotelCardDialogListing/index.tsx b/components/HotelReservation/HotelCardDialogListing/index.tsx
index 123cc4ced..7e8750ec2 100644
--- a/components/HotelReservation/HotelCardDialogListing/index.tsx
+++ b/components/HotelReservation/HotelCardDialogListing/index.tsx
@@ -17,7 +17,7 @@ export default function HotelCardDialogListing({
activeCard,
onActiveCardChange,
}: HotelCardDialogListingProps) {
- const hotelsPinData = getHotelPins(hotels)
+ const hotelsPinData = hotels ? getHotelPins(hotels) : []
const activeCardRef = useRef(null)
const observerRef = useRef(null)
const dialogRef = useRef(null)
diff --git a/components/HotelReservation/HotelCardDialogListing/utils.ts b/components/HotelReservation/HotelCardDialogListing/utils.ts
index 2299b3f35..1a0e05ad8 100644
--- a/components/HotelReservation/HotelCardDialogListing/utils.ts
+++ b/components/HotelReservation/HotelCardDialogListing/utils.ts
@@ -2,6 +2,8 @@ import type { HotelData } from "@/types/components/hotelReservation/selectHotel/
import type { HotelPin } from "@/types/components/hotelReservation/selectHotel/map"
export function getHotelPins(hotels: HotelData[]): HotelPin[] {
+ if (hotels.length === 0) return []
+
return hotels.map((hotel) => ({
coordinates: {
lat: hotel.hotelData.location.latitude,
diff --git a/lib/trpc/memoizedRequests/index.ts b/lib/trpc/memoizedRequests/index.ts
index 7db2e66da..2bf35c264 100644
--- a/lib/trpc/memoizedRequests/index.ts
+++ b/lib/trpc/memoizedRequests/index.ts
@@ -144,7 +144,7 @@ export const getBookingConfirmation = cache(
export const getCityCoordinates = cache(
async function getMemoizedCityCoordinates(input: {
city: string
- hotel: { address: string }
+ hotel: { address: string | undefined }
}) {
return serverClient().hotel.map.city(input)
}
diff --git a/server/routers/hotels/input.ts b/server/routers/hotels/input.ts
index a4e47caf3..4a66009b3 100644
--- a/server/routers/hotels/input.ts
+++ b/server/routers/hotels/input.ts
@@ -77,6 +77,6 @@ export const getRoomPackagesInputSchema = z.object({
export const getCityCoordinatesInputSchema = z.object({
city: z.string(),
hotel: z.object({
- address: z.string(),
+ address: z.string().optional(),
}),
})
diff --git a/types/components/hotelReservation/selectHotel/hotelCardListingProps.ts b/types/components/hotelReservation/selectHotel/hotelCardListingProps.ts
index 68a6174ed..eb84b6977 100644
--- a/types/components/hotelReservation/selectHotel/hotelCardListingProps.ts
+++ b/types/components/hotelReservation/selectHotel/hotelCardListingProps.ts
@@ -18,3 +18,7 @@ export type HotelData = {
hotelData: Hotel
price: ProductType
}
+
+export interface NullableHotelData extends Omit {
+ hotelData: HotelData["hotelData"] | null
+}
diff --git a/types/components/hotelReservation/selectHotel/map.ts b/types/components/hotelReservation/selectHotel/map.ts
index 4ec21f86f..19490464d 100644
--- a/types/components/hotelReservation/selectHotel/map.ts
+++ b/types/components/hotelReservation/selectHotel/map.ts
@@ -56,7 +56,7 @@ export interface HotelCardDialogProps {
}
export interface HotelCardDialogListingProps {
- hotels: HotelData[]
+ hotels: HotelData[] | null
activeCard: string | null | undefined
onActiveCardChange: (hotelName: string | null) => void
}