Merged in fix/hotelreservation-skeletons (pull request #1270)

fix: skeletons in hotelreservation key includes all search params

* fix: skeletons in hotelreservation key includes all search params


Approved-by: Joakim Jäderberg
This commit is contained in:
Linus Flood
2025-02-06 13:30:18 +00:00
parent c62ebb83bb
commit 9ad8d39712
3 changed files with 16 additions and 3 deletions

View File

@@ -16,11 +16,16 @@ export default async function SelectHotelMapPage({
}: PageArgs<LangParams, SelectHotelSearchParams>) { }: PageArgs<LangParams, SelectHotelSearchParams>) {
setLang(params.lang) setLang(params.lang)
const roomKey = Object.keys(searchParams)
.filter((key) => key.startsWith("room["))
.map((key) => searchParams[key])
.join("-")
return ( return (
<div className={styles.main}> <div className={styles.main}>
<MapContainer> <MapContainer>
<Suspense <Suspense
key={searchParams.city} key={`${searchParams.city}-${searchParams.fromDate}-${searchParams.toDate}-${roomKey}`}
fallback={<SelectHotelMapContainerSkeleton />} fallback={<SelectHotelMapContainerSkeleton />}
> >
<SelectHotelMapContainer searchParams={searchParams} /> <SelectHotelMapContainer searchParams={searchParams} />

View File

@@ -20,7 +20,7 @@ export default async function SelectHotelPage({
return ( return (
<Suspense <Suspense
key={`${searchParams.name}-${searchParams.fromDate}-${searchParams.toDate}-${roomKey}`} key={`${searchParams.city}-${searchParams.fromDate}-${searchParams.toDate}-${roomKey}`}
fallback={<SelectHotelSkeleton />} fallback={<SelectHotelSkeleton />}
> >
<SelectHotel params={params} searchParams={searchParams} /> <SelectHotel params={params} searchParams={searchParams} />

View File

@@ -79,6 +79,11 @@ export default async function SelectRatePage({
const hotelId = +hotel.id const hotelId = +hotel.id
const roomKey = Object.keys(searchParams)
.filter((key) => key.startsWith("room["))
.map((key) => searchParams[key])
.join("-")
return ( return (
<> <>
<HotelInfoCard <HotelInfoCard
@@ -90,7 +95,10 @@ export default async function SelectRatePage({
childArray={childrenInRoom} childArray={childrenInRoom}
/> />
<Suspense key={hotelId} fallback={<RoomsContainerSkeleton />}> <Suspense
key={`${searchParams.city}-${searchParams.fromDate}-${searchParams.toDate}-${roomKey}-${searchParams.hotelId}`}
fallback={<RoomsContainerSkeleton />}
>
<RoomsContainer <RoomsContainer
hotelId={hotelId} hotelId={hotelId}
lang={params.lang} lang={params.lang}