Merge pull request #6 from zvx-echo6/feat/directions-origin-row

fix(navi/ui): always render origin + destination rows in directions panel
This commit is contained in:
malice 2026-05-24 10:23:10 -06:00 committed by GitHub
commit 777a311c2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -98,15 +98,13 @@ export default function DirectionsPanel({ onClose }) {
// Each item has: { id, type, data } // Each item has: { id, type, data }
const unifiedList = useMemo(() => { const unifiedList = useMemo(() => {
const items = [] const items = []
if (routeStart) { // Always render origin first and destination last, even when unset (data:null);
items.push({ id: "origin", type: "origin", data: routeStart }) // LocationInput shows its placeholder for value={null}. Stops sit in between.
} items.push({ id: "origin", type: "origin", data: routeStart })
stops.forEach((stop) => { stops.forEach((stop) => {
items.push({ id: stop.id, type: "stop", data: stop }) items.push({ id: stop.id, type: "stop", data: stop })
}) })
if (routeEnd) { items.push({ id: "destination", type: "destination", data: routeEnd })
items.push({ id: "destination", type: "destination", data: routeEnd })
}
return items return items
}, [routeStart, stops, routeEnd]) }, [routeStart, stops, routeEnd])