diff --git a/apps/src/components/map-layers/search-control.tsx b/apps/src/components/map-layers/search-control.tsx index 087262d48..f93e16348 100644 --- a/apps/src/components/map-layers/search-control.tsx +++ b/apps/src/components/map-layers/search-control.tsx @@ -95,7 +95,7 @@ const SearchControl = ({ const map = useMap(); const handleLocationChange = useCallback( - async (inputLatlng: SearchLatLng) => { + async (inputLatlng: SearchLatLng, searchProvidedTitle?: string) => { const latlng = convertSearchLatLng(inputLatlng); // clear all existing markers from the map map.eachLayer(layer => { @@ -105,6 +105,11 @@ const SearchControl = ({ }); map.setView(latlng, SEARCH_DEFAULT_ZOOM); await dispatchMapClick(map, latlng); + + // #Illustration + // What was done before dispatchMapClick that was done here + console.info('earlier iteration had layerRef.current.fire("click", ...) setting searchProvidedTitle', { searchProvidedTitle }); + }, [ map, @@ -235,7 +240,7 @@ const SearchControl = ({ // Fetch location data const locationByCoords = await fetchLocationByCoords({ lat: latLng.lat, lng: latLng.lon }); // Trigger show location. - this.showLocation(locationByCoords, locationByCoords.geo_id); + this.showLocation(locationByCoords, locationByCoords.title); // T19 — geo_id is the strange string we get } else { // Show error alert. @@ -250,8 +255,8 @@ const SearchControl = ({ popupAnchor: [0, -41], // Popup position relative to the icon }), }), - moveToLocation: (latlng: SearchLatLng) => { - handleLocationChange(latlng); + moveToLocation: (latlng: SearchLatLng, searchProvidedTitle: string) => { + handleLocationChange(latlng, searchProvidedTitle); }, }); diff --git a/fw-child/resources/functions/rest.php b/fw-child/resources/functions/rest.php index afd6ca522..991c95dfa 100644 --- a/fw-child/resources/functions/rest.php +++ b/fw-child/resources/functions/rest.php @@ -367,7 +367,7 @@ function cdc_get_location_by_coords () { "geo_name", "gen_term" . $term_append . " as generic_term", "location", - "province" . $term_append, + "province" . $term_append . " as province", "lat", "lon" );