Symptoms
The "Navigate" button in the geocode-bar (next to Copy) silently does nothing in two flows:
- Search → Go to location: tap a search result's "Go to location" → bar shows → tap Navigate → nothing happens.
- Long-press, then drag the pin: long-press to drop a pin → drag to a new location → bar updates → tap Navigate → starts navigation to the original drop location, not the dragged location.
(Long-press without a subsequent drag works correctly.)
Root cause
currentPinLatLng is captured via a pinLayer.on('layeradd') listener. layeradd only fires when a new layer is added to the group:
- Search Go to location: the handler calls
pinLayer.clearLayers() and never adds a new pin → currentPinLatLng stays null (or worse, holds the value from the previous long-press) → click silently returns.
- Pin drag: the marker moves but isn't re-added →
layeradd doesn't fire → currentPinLatLng keeps the original drop location.
Fix
Thread the destination L.LatLng through showGeocodeBar(label, copyText, latlng). Set currentPinLatLng inside that function — showGeocodeBar is the single setter that all three flows (search, long-press, drag) already converge on. Remove the unreliable layeradd listener.
Also add a defensive toast ("No destination set") instead of the silent return, so any future regression surfaces visibly.
Acceptance
Symptoms
The "Navigate" button in the geocode-bar (next to Copy) silently does nothing in two flows:
(Long-press without a subsequent drag works correctly.)
Root cause
currentPinLatLngis captured via apinLayer.on('layeradd')listener.layeraddonly fires when a new layer is added to the group:pinLayer.clearLayers()and never adds a new pin →currentPinLatLngstaysnull(or worse, holds the value from the previous long-press) → click silently returns.layeradddoesn't fire →currentPinLatLngkeeps the original drop location.Fix
Thread the destination
L.LatLngthroughshowGeocodeBar(label, copyText, latlng). SetcurrentPinLatLnginside that function —showGeocodeBaris the single setter that all three flows (search, long-press, drag) already converge on. Remove the unreliablelayeraddlistener.Also add a defensive toast ("No destination set") instead of the silent return, so any future regression surfaces visibly.
Acceptance
npm run type-check && npm run lint && npm testclean