Fix dragend: update waypoint through proxy, not stale closure reference

This commit is contained in:
Davide Scaini
2026-05-13 22:47:42 +02:00
parent db15e6f7ed
commit df9ec3141c
+5 -3
View File
@@ -75,9 +75,11 @@
const wp = { lng, lat, marker };
marker.on('dragend', () => {
const { lng: newLng, lat: newLat } = marker.getLngLat();
wp.lng = newLng;
wp.lat = newLat;
waypoints = waypoints; // trigger reactivity
const i = waypoints.findIndex(w => w.marker === marker);
if (i >= 0) {
waypoints[i].lng = newLng;
waypoints[i].lat = newLat;
}
fetchRoute();
});