Merged in fix/SW-3034-incorrect-room-facilities (pull request #2361)
fix(SW-3034): Fix issue where room amenities is displayed incorrectly on hotel page * fix(SW-2024): don't mutate room array Approved-by: Erik Tiekstra Approved-by: Linus Flood
This commit is contained in:
@@ -19,7 +19,7 @@ export function Rooms({ heading, rooms, preamble }: RoomsProps) {
|
|||||||
const showToggleButton = rooms.length > 3
|
const showToggleButton = rooms.length > 3
|
||||||
const [allRoomsVisible, setAllRoomsVisible] = useState(!showToggleButton)
|
const [allRoomsVisible, setAllRoomsVisible] = useState(!showToggleButton)
|
||||||
const sortedRooms = useMemo(() => {
|
const sortedRooms = useMemo(() => {
|
||||||
return rooms.sort((a, b) => a.sortOrder - b.sortOrder)
|
return [...rooms].sort((a, b) => a.sortOrder - b.sortOrder)
|
||||||
}, [rooms])
|
}, [rooms])
|
||||||
|
|
||||||
const scrollRef = useRef<HTMLDivElement>(null)
|
const scrollRef = useRef<HTMLDivElement>(null)
|
||||||
|
|||||||
Reference in New Issue
Block a user