Suspense on <TrackingSDK>

This commit is contained in:
Linus Flood
2024-12-06 15:47:34 +01:00
parent 6a4364e1c4
commit 115d1f0a10
12 changed files with 94 additions and 53 deletions

View File

@@ -30,17 +30,17 @@ export default async function SelectRatePage({
}: PageArgs<LangParams & { section: string }, SelectRateSearchParams>) {
setLang(params.lang)
const locations = await getLocations()
if (!locations || "error" in locations) {
return null
}
const hotel = locations.data.find(
(location) =>
"operaId" in location && location.operaId == searchParams.hotel
)
if (!hotel) {
return notFound()
}
// const locations = await getLocations()
// if (!locations || "error" in locations) {
// return null
// }
// const hotel = locations.data.find(
// (location) =>
// "operaId" in location && location.operaId == searchParams.hotel
// )
// if (!hotel) {
// return notFound()
// }
const selectRoomParams = new URLSearchParams(searchParams)
const selectRoomParamsObject =
getHotelReservationQueryParams(selectRoomParams)
@@ -101,6 +101,7 @@ export default async function SelectRatePage({
}
const hotelId = +searchParams.hotel
return (
<>
<HotelInfoCard
@@ -122,7 +123,12 @@ export default async function SelectRatePage({
childArray={children}
/>
</Suspense>
<TrackingSDK pageData={pageTrackingData} hotelInfo={hotelsTrackingData} />
<Suspense fallback={null}>
<TrackingSDK
pageData={pageTrackingData}
hotelInfo={hotelsTrackingData}
/>
</Suspense>
</>
)
}