diff --git a/src/lib/components/lnv/LocationSelect.svelte b/src/lib/components/lnv/LocationSelect.svelte index 4164afa..cfc1752 100644 --- a/src/lib/components/lnv/LocationSelect.svelte +++ b/src/lib/components/lnv/LocationSelect.svelte @@ -53,21 +53,26 @@ async function getCoordLabel(value: `${number},${number}`) { const splitter = value.split(","); + console.log(`getCoordLabel(${value})`); const res = await reverseGeocode({ lat: parseFloat(splitter[0]), lon: parseFloat(splitter[1]), }); if (res.length == 0) return ""; const feature = res[0]; + console.log(`getCoordLabel(${value}) == ${feature.properties.name}`); return feature.properties.name; } const selectedValue = $derived( new Promise((r) => { - r( - locations.find((f) => f.value === value)?.label || - getCoordLabel(value).then((v) => r(v)), - ); + if (locations.find((f) => f.value === value)) { + return r(locations.find((f) => f.value === value)?.label); + } + getCoordLabel(value).then((v) => r(v)); + }).then((label) => { + console.log("[LocationSelect] selectedValue", { value, label }); + return label; }), );