From 871662bccf92c4da1b568783e4febdbefe3ce3cd Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 1 May 2026 18:51:39 +0000 Subject: [PATCH 1/2] fix(PlaceCard): correct boundary fetch for basemap label clicks When clicking city/area labels with wikidataId, the wikidata path now: 1. Always runs when wikidataId is present (removed OSM data guard) 2. Sets osm_type='R' and osm_id from wikidata's osm_relation_id 3. This allows Effect 3 (fetchPlaceDetails) to then fetch wiki_summary Also prevents Effect 2 (reverse geocode) from overwriting OSM data that was already set by the wikidata path. Fixes: boundary outline, fly-to-bounds, wiki summary display Co-Authored-By: Claude Opus 4.5 --- src/components/PlaceCard.jsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/PlaceCard.jsx b/src/components/PlaceCard.jsx index 40c4660..8fab953 100644 --- a/src/components/PlaceCard.jsx +++ b/src/components/PlaceCard.jsx @@ -359,6 +359,8 @@ export function PlaceCard({ place, variant = "preview", expanded = true, onToggl if (result?.raw?.osm_type && result?.raw?.osm_id) { const current = useStore.getState().selectedPlace if (current && current.lat === placeLat && current.lon === placeLon) { + // Skip if OSM data already set (e.g., by wikidata path with osm_relation_id) + if (current.raw?.osm_type && current.raw?.osm_id) return // Merge OSM data into raw, preserving existing data useStore.getState().setSelectedPlace({ ...current, @@ -393,7 +395,7 @@ export function PlaceCard({ place, variant = "preview", expanded = true, onToggl }, [osmType, osmId, placeLat, placeLon]) useEffect(() => { - if (osmType && osmId) return + // Always run wikidata path when wikidataId is present if (!wikidataId) return const controller = new AbortController() fetchPlaceByWikidata(wikidataId, controller.signal).then((data) => { @@ -405,6 +407,16 @@ export function PlaceCard({ place, variant = "preview", expanded = true, onToggl osm_relation_id: data.osm_relation_id, extratags: { ...(prev && prev !== "loading" ? prev.extratags : {}), ...data.extratags }, })) + // Set OSM data from wikidata response so Effect 3 can fetch wiki_summary + if (data.osm_relation_id) { + const current = useStore.getState().selectedPlace + if (current && current.lat === placeLat && current.lon === placeLon) { + useStore.getState().setSelectedPlace({ + ...current, + raw: { ...current.raw, osm_type: "R", osm_id: data.osm_relation_id } + }) + } + } if (data?.boundary) { const current = useStore.getState().selectedPlace if (current && current.lat === placeLat && current.lon === placeLon) { @@ -417,7 +429,7 @@ export function PlaceCard({ place, variant = "preview", expanded = true, onToggl } }) return () => controller.abort() - }, [wikidataId, osmType, osmId, placeLat, placeLon]) + }, [wikidataId, placeLat, placeLon]) useEffect(() => { if (variant !== "preview" || !userLocation || placeLat == null || placeLon == null) { setDriveTime(null); return } From 40d93a113a5cac89a3123346b13892c67890b93c Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 1 May 2026 20:38:15 +0000 Subject: [PATCH 2/2] debug: boundary layer fix attempt - not working --- src/components/MapView.jsx | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/components/MapView.jsx b/src/components/MapView.jsx index a49143e..f9120d3 100644 --- a/src/components/MapView.jsx +++ b/src/components/MapView.jsx @@ -1288,8 +1288,8 @@ function addBoundaryLayer(map) { source: BOUNDARY_SOURCE, paint: { "line-color": accentColor, - "line-width": 2, - "line-opacity": 0.7, + "line-width": 2.5, + "line-opacity": 0.8, "line-dasharray": [3, 2], }, }, firstSymbolId) @@ -1504,8 +1504,8 @@ const MapView = forwardRef(function MapView(_, ref) { type: "line", source: MEASURE_SOURCE, paint: { - "line-color": accentColor, - "line-width": 2, + "line-color": "#ff0000", + "line-width": 8, "line-dasharray": [8, 4], }, }) @@ -2176,6 +2176,34 @@ const MapView = forwardRef(function MapView(_, ref) { properties: {}, }) + console.log("BOUNDARY DEBUG:") + console.log(" source exists:", !!map.getSource(BOUNDARY_SOURCE)) + console.log(" line layer exists:", !!map.getLayer(BOUNDARY_LAYER)) + console.log(" fill layer exists:", !!map.getLayer(BOUNDARY_FILL_LAYER)) + console.log(" line-color:", map.getPaintProperty(BOUNDARY_LAYER, "line-color")) + console.log(" line-opacity:", map.getPaintProperty(BOUNDARY_LAYER, "line-opacity")) + console.log(" line-width:", map.getPaintProperty(BOUNDARY_LAYER, "line-width")) + console.log(" fill-color:", map.getPaintProperty(BOUNDARY_FILL_LAYER, "fill-color")) + console.log(" visibility:", map.getLayoutProperty(BOUNDARY_LAYER, "visibility")) + console.log(" feature count:", source._data?.features?.length || "unknown") + console.log(" geometry type:", boundaryGeometry.type) + console.log(" coord count:", boundaryGeometry.type === "Polygon" ? boundaryGeometry.coordinates[0]?.length : boundaryGeometry.coordinates?.length) + console.log(" first coord:", boundaryGeometry.type === "Polygon" ? boundaryGeometry.coordinates[0]?.[0] : boundaryGeometry.coordinates?.[0]?.[0]?.[0]) + console.log(" map center:", map.getCenter()) + console.log(" map zoom:", map.getZoom()) + + // Check if layer is actually in style + const styleLayers = map.getStyle().layers + const boundaryLayerInStyle = styleLayers.find(l => l.id === BOUNDARY_LAYER) + console.log(" layer in style.layers:", !!boundaryLayerInStyle) + if (boundaryLayerInStyle) { + console.log(" layer def:", JSON.stringify(boundaryLayerInStyle)) + } + + // Force repaint + map.triggerRepaint() + console.log(" triggered repaint") + // Zoom to fit boundary try { const coords = boundaryGeometry.type === 'Polygon'