Merged in fix/SW-3001-select-hotel-booking-code- (pull request #2576)

Fix/SW-3001 select hotel booking code

* fix(SW-3001): Fixed booking code filter store to reset to default state when new search triggered, Removed state as using useState resets the value on every filter change

* fix: Route tracking parsing error in select-hotel page

* fix(SW-3001): Optimized code


Approved-by: Matilda Landström
This commit is contained in:
Hrishikesh Vaipurkar
2025-07-30 09:39:58 +00:00
parent 9bbea3f16f
commit f5531e8238
4 changed files with 26 additions and 16 deletions

View File

@@ -20,6 +20,7 @@ import type {
VoucherProduct,
} from "@scandic-hotels/trpc/types/roomAvailability"
import type { BookingWidgetSearchData } from "@/types/components/bookingWidget"
import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast"
import { type RoomRate } from "@/types/components/hotelReservation/enterDetails/details"
import type { Price } from "@/types/components/hotelReservation/price"
@@ -48,18 +49,18 @@ export function extractGuestFromUser(user: NonNullable<SafeUser>) {
}
export function checkIsSameBooking(
prev: SelectRateBooking & { errorCode?: string },
next: SelectRateBooking & { errorCode?: string }
prev: (SelectRateBooking | BookingWidgetSearchData) & { errorCode?: string },
next: (SelectRateBooking | BookingWidgetSearchData) & { errorCode?: string }
) {
const { rooms: prevRooms, errorCode: prevErrorCode, ...prevBooking } = prev
const prevRoomsWithoutRateCodes = prevRooms?.map(
({ rateCode, counterRateCode, roomTypeCode, bookingCode, ...room }) => room
({ adults, childrenInRoom }) => ({ adults, childrenInRoom })
)
const { rooms: nextRooms, errorCode: nextErrorCode, ...nextBooking } = next
const nextRoomsWithoutRateCodes = nextRooms?.map(
({ rateCode, counterRateCode, roomTypeCode, bookingCode, ...room }) => room
({ adults, childrenInRoom }) => ({ adults, childrenInRoom })
)
return isEqual(