From 9db8cec0f679d53fd7343b8b4e397e176451c8f4 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 26 Apr 2026 23:07:59 +0000 Subject: [PATCH] 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. --- src/store.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/store.js b/src/store.js index 7949d95..42f90c3 100644 --- a/src/store.js +++ b/src/store.js @@ -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 }) } },