Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions apps/src/components/map-layers/search-control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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,
Expand Down Expand Up @@ -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.
Expand All @@ -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);
},
});

Expand Down
2 changes: 1 addition & 1 deletion fw-child/resources/functions/rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
Expand Down