From f1473c1a7c310ef7e2992947fc60713007340f41 Mon Sep 17 00:00:00 2001 From: Pontus Dreij Date: Wed, 4 Dec 2024 10:53:24 +0100 Subject: [PATCH] fix(SW-1111): Fix close button on map --- .../HotelReservation/SelectHotel/SelectHotelMap/index.tsx | 7 ++++++- .../Maps/InteractiveMap/HotelListingMapContent/index.tsx | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/HotelReservation/SelectHotel/SelectHotelMap/index.tsx b/components/HotelReservation/SelectHotel/SelectHotelMap/index.tsx index 4208d4871..7820d72b9 100644 --- a/components/HotelReservation/SelectHotel/SelectHotelMap/index.tsx +++ b/components/HotelReservation/SelectHotel/SelectHotelMap/index.tsx @@ -83,7 +83,12 @@ export default function SelectHotelMap({ } function handlePageRedirect() { - router.push(`${selectHotel(lang)}?${searchParams.toString()}`) + const newUrl = `${selectHotel(lang)}?${searchParams.toString()}` + if (window.history.length > 1) { + router.back() + } else { + router.push(newUrl) + } } const closeButton = ( diff --git a/components/Maps/InteractiveMap/HotelListingMapContent/index.tsx b/components/Maps/InteractiveMap/HotelListingMapContent/index.tsx index 9f4c189c0..39498c3b3 100644 --- a/components/Maps/InteractiveMap/HotelListingMapContent/index.tsx +++ b/components/Maps/InteractiveMap/HotelListingMapContent/index.tsx @@ -100,4 +100,4 @@ function HotelListingMapContent({ ) } -export default memo(HotelListingMapContent) +export default HotelListingMapContent