Skip to content

Commit e2cc341

Browse files
authored
fix: geocoder coordinate search results not showing (#2245) (#3322)
When entering coordinates in the geocoder search box, the results dropdown might not appear or could be overwritten by a pending geocoder API call. Fix by: 1. Clearing any pending geocoder debounce timeout when valid coordinates are detected, preventing stale API results from overwriting the coordinate result. 2. Explicitly setting showResults to true to ensure the dropdown is visible. Signed-off-by: pierreeurope <pierre.europe@pm.me>
1 parent 1c2db0f commit e2cc341

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/components/src/geocoder/geocoder.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@ const GeoCoder: React.FC<GeocoderProps & IntlProps> = ({
164164
setInputValue(queryString);
165165
const resultCoordinates = testForCoordinates(queryString);
166166
if (resultCoordinates[0]) {
167+
if (debounceTimeout) {
168+
clearTimeout(debounceTimeout);
169+
}
167170
const [_isValid, longitude, latitude] = resultCoordinates;
171+
setShowResults(true);
168172
setResults([{center: [longitude, latitude], place_name: queryString}]);
169173
} else {
170174
if (debounceTimeout) {

0 commit comments

Comments
 (0)