mirror of
https://github.com/zvx-echo6/navi.git
synced 2026-05-20 14:44:51 +02:00
fix(PlaceCard): prioritize wikidata path for boundary fetch
When clicking basemap labels with wikidata IDs (cities, parks, etc), fetchReverse was returning the nearest POI instead of the clicked entity, blocking the wikidata fallback that returns correct boundaries. Changes: - Effect 1: Skip reverse geocode when wikidataId is present - Effect 3: Always use wikidata path when available, regardless of osmType/osmId presence This fixes missing dashed outline on area feature clicks. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6fb3ee4f49
commit
2e0a885476
1 changed files with 3 additions and 3 deletions
|
|
@ -348,8 +348,9 @@ export function PlaceCard({ place, variant = "preview", expanded = true, onToggl
|
||||||
// Reverse geocode to get OSM type/id if not present (e.g., basemap label clicks)
|
// Reverse geocode to get OSM type/id if not present (e.g., basemap label clicks)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!hasFeature('has_nominatim_details')) return
|
if (!hasFeature('has_nominatim_details')) return
|
||||||
if (osmType && osmId) return
|
if (wikidataId) return // Prefer wikidata path for basemap features with wikidata
|
||||||
if (placeLat == null || placeLon == null) return
|
if (placeLat == null || placeLon == null) return
|
||||||
|
if (osmType && osmId) return
|
||||||
// Skip for dropped pins - they get reverse geocoded by MapView
|
// Skip for dropped pins - they get reverse geocoded by MapView
|
||||||
if (place?.source === 'map_click') return
|
if (place?.source === 'map_click') return
|
||||||
|
|
||||||
|
|
@ -368,7 +369,7 @@ export function PlaceCard({ place, variant = "preview", expanded = true, onToggl
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return () => controller.abort()
|
return () => controller.abort()
|
||||||
}, [placeLat, placeLon, osmType, osmId, place?.source])
|
}, [wikidataId, placeLat, placeLon, osmType, osmId, place?.source])
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -393,7 +394,6 @@ export function PlaceCard({ place, variant = "preview", expanded = true, onToggl
|
||||||
}, [osmType, osmId, placeLat, placeLon])
|
}, [osmType, osmId, placeLat, placeLon])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (osmType && osmId) return
|
|
||||||
if (!wikidataId) return
|
if (!wikidataId) return
|
||||||
const controller = new AbortController()
|
const controller = new AbortController()
|
||||||
fetchPlaceByWikidata(wikidataId, controller.signal).then((data) => {
|
fetchPlaceByWikidata(wikidataId, controller.signal).then((data) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue