From 6871b154db59a6c3041a48c986f66c81f6ab7047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Thu, 16 Jul 2026 07:59:48 +0200 Subject: [PATCH] fix(planner): clicking a waypoint no longer adds a duplicate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Waypoint markers had no click listener, so Leaflet routed the click to the map — MapClickHandler then added a new waypoint on top of the one you clicked (and made markers feel unresponsive). Add a click handler that consumes the event, so Leaflet treats the marker as the target and suppresses the map click. Co-Authored-By: Claude Opus 4.8 --- apps/planner/app/components/PlannerMap.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/planner/app/components/PlannerMap.tsx b/apps/planner/app/components/PlannerMap.tsx index 181cd01..d38b9ba 100644 --- a/apps/planner/app/components/PlannerMap.tsx +++ b/apps/planner/app/components/PlannerMap.tsx @@ -195,6 +195,11 @@ export function PlannerMap({ yjs, sessionId, onRouteRequest, highlightPosition, zIndexOffset={highlightedWaypoint === i ? Z_WAYPOINT_HIGHLIGHTED : Z_WAYPOINT} icon={waypointIcon(i, wp.overnight, highlightedWaypoint === i, !!wp.note)} eventHandlers={{ + // Consume the click on the marker. Without a click listener, + // Leaflet routes the click to the map (which adds a duplicate + // waypoint on top of this one). Registering it makes Leaflet + // treat the marker as the event target instead. + click: (e) => { e.originalEvent.stopPropagation(); }, mouseover: () => { routeInteractionSuspendedRef.current = true; }, mouseout: () => { if (!waypointDraggingRef.current) routeInteractionSuspendedRef.current = false;