fix: duplicate stop when GPS denied and selecting origin via search

Bug: clicking Get Directions with GPS denied would add the destination
to stops AND set pendingDestination. Then when user selected an origin
via search, selectResult would add the origin AND re-add the pending
destination, resulting in 3 stops (A=dest, B=origin, C=dest again).

Fix: in startDirections GPS-denied path, only set pendingDestination
without adding to stops. The SearchBar selectResult handler already
adds both origin and pending destination when pending exists.
This commit is contained in:
Matt 2026-04-26 23:07:59 +00:00
commit 9db8cec0f6

View file

@ -85,9 +85,7 @@ export const useStore = create((set, get) => ({
addStop({ lat: place.lat, lon: place.lon, name: place.name, source: place.source, matchCode: place.matchCode })
set({ selectedPlace: null })
} else {
// GPS denied, no stops: add destination, show empty origin slot
clearStops()
addStop({ lat: place.lat, lon: place.lon, name: place.name, source: place.source, matchCode: place.matchCode })
// GPS denied, no stops: set pendingDestination only; origin-picker will add both
set({ pendingDestination: place, selectedPlace: null })
}
},