From 6f07aa3563aaa0114caa529e778a2bef843da123 Mon Sep 17 00:00:00 2001 From: Renoir Boulanger Date: Mon, 27 Apr 2026 16:37:55 -0400 Subject: [PATCH 1/4] CLIM-1322: BEGIN From d2bfa8fde38eb4bf4edbc1a7054249228af1ea77 Mon Sep 17 00:00:00 2001 From: Renoir Boulanger Date: Wed, 15 Apr 2026 11:32:40 -0400 Subject: [PATCH 2/4] CLIM-1322: Strange stuff when search using lat,lon coordinates --- apps/src/components/map-layers/search-control.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/src/components/map-layers/search-control.tsx b/apps/src/components/map-layers/search-control.tsx index 087262d48..a8e386c78 100644 --- a/apps/src/components/map-layers/search-control.tsx +++ b/apps/src/components/map-layers/search-control.tsx @@ -235,7 +235,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. From cf2be9bd715b34c07c6bad688e4c94497f6005e7 Mon Sep 17 00:00:00 2001 From: Renoir Boulanger Date: Mon, 27 Apr 2026 16:39:20 -0400 Subject: [PATCH 3/4] CLIM-1322: BIFURCATION FIXING 1223 THEN RESUMED Earlier commit salvaged from closed PR 674 From 904d0dcf252cf44a045bb7fd7d492e4dd175fb91 Mon Sep 17 00:00:00 2001 From: Renoir Boulanger Date: Tue, 19 May 2026 12:02:59 -0400 Subject: [PATCH 4/4] =?UTF-8?q?CLIM-1322:=20Illustrative=20bandaid=20?= =?UTF-8?q?=E2=80=94=20EDITED?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Edited: 2026-05-19 This branch was originally written BEFORE creating `dispatchMapClick` and has been now merged to main in PR #676. During the rebase that followed 676 the important aspect of `CLIM-1322_Popup-Title-Name-Resolution` was to pass the title. Passing the title was an illustrative "band aid" and we've kept this branch to return back to it later. After Passes 2 supplemental passes (...): - #682 branch `CLIM-1322_2_Popup-Title-Name-Resolution` - #684 branch `CLIM-1322_3_Popup-Title-Name-Resolution` We've decided to return to what this branch initially suggested. Simply to pass the title from the click handler. This commit is there to illustrate what was lost during the iterations to set the record straight. Commits that had gotten lost and were part of this branch this commit is replacing: - https://github.com/CanadianClimateDataPortal/climatedata-wp-theme/commit/72a0df4e59dcab0f0db66cf6cffcba5bfd27a23c - https://github.com/CanadianClimateDataPortal/climatedata-wp-theme/commit/f9169bb1d4abe77059abe05d75945aa685cc094f Earlier commit message: Map search popup was showing neighboring Community names (e.g. "Toronto" → "North York") because handleLocationChange fired a synthetic click that discarded the search item's pre-resolved title, forcing handleClick to re-derive from lat/lng via fetchLocationByCoords, which snaps to the nearest 'Community' / 'Metropolitan Area' and filters out 'City' entries server-side. D1a from the Analysis Plan: plumb buildLocationTitle(item) through handleLocationChange into the synthetic click payload as an optional searchProvidedTitle field. handleClick prefers it over fetchLocationByCoords when the mode is GRIDDED_DATA, skipping the network call on the happy path. This is the third optional field on the synthetic click payload (joining layer.properties from CLIM-1223). Submitted as a draft PR for team discussion on whether to continue the bandaid pattern or escalate to the structural refactor in D1c. See [[LLM-Context-ClimateData-Ticket-CLIM-1322-Analysis-Plan]] for the full design trade-off. --- apps/src/components/map-layers/search-control.tsx | 11 ++++++++--- fw-child/resources/functions/rest.php | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/src/components/map-layers/search-control.tsx b/apps/src/components/map-layers/search-control.tsx index a8e386c78..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, @@ -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" );