Merged in fix/SW-3117-filter-select-hotel (pull request #2475)

Fix/SW-3117 filter select hotel

* fix(SW-3117): default hotel count fix

* fix(SW-3117): default hotel count for mobile


Approved-by: Tobias Johansson
Approved-by: Matilda Landström
This commit is contained in:
Bianca Widstam
2025-07-01 06:33:04 +00:00
parent 5ba31f6afe
commit 86bd3fcea3
6 changed files with 19 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
import { useCallback, useEffect, useRef } from "react"
import { useIntl } from "react-intl"
import { useHotelFilterStore } from "@/stores/hotel-filters"
import { useHotelsMapStore } from "@/stores/hotels-map"
import ListingHotelCardDialog from "../HotelCardDialog/ListingHotelCardDialog"
@@ -14,6 +15,7 @@ import type { HotelCardDialogListingProps } from "@/types/components/hotelReserv
export default function HotelCardDialogListing({
hotels,
unfilteredHotelCount,
}: HotelCardDialogListingProps) {
const intl = useIntl()
const isRedemption = hotels?.find(
@@ -31,6 +33,7 @@ export default function HotelCardDialogListing({
const isScrollingRef = useRef<boolean>(false)
const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
const { activeHotel, activate, deactivate } = useHotelsMapStore()
const setResultCount = useHotelFilterStore((state) => state.setResultCount)
const handleIntersection = useCallback(
(entries: IntersectionObserverEntry[]) => {
@@ -118,6 +121,10 @@ export default function HotelCardDialogListing({
}
}, [dialogRef, activeHotel, deactivate])
useEffect(() => {
setResultCount(hotels.length, unfilteredHotelCount)
}, [hotels, setResultCount, unfilteredHotelCount])
return (
<div className={styles.hotelCardDialogListing} ref={dialogRef}>
{hotelsPinData?.map((data) => {