Set to the best guess (first city) if no option selected

This commit is contained in:
MartinBraquet
2026-02-27 15:09:28 +01:00
parent 2531ee6fe4
commit 19ee048536

View File

@@ -1124,6 +1124,8 @@ const CitySearchBox = (props: {onCitySelected: (city: City | undefined) => void}
if (dropdownRef.current && !dropdownRef.current.contains(e.relatedTarget)) {
setFocused(false)
}
// Set to the best guess (first city) if no option selected
if (cities.length > 0) props.onCitySelected(cities[0])
}}
/>
<div className="relative w-full" ref={dropdownRef}>