From 2f46d49016281758b786fa922595f7b146280ad4 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sun, 26 Apr 2026 09:56:55 -0500 Subject: [PATCH] feat(rover): clear selected candidate + path lines on recalculate --- assets/js/rover_map_hook.ts | 11 ++++++++++- lib/microwaveprop_web/live/rover_live.ex | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/assets/js/rover_map_hook.ts b/assets/js/rover_map_hook.ts index e2815913..aca7abec 100644 --- a/assets/js/rover_map_hook.ts +++ b/assets/js/rover_map_hook.ts @@ -276,7 +276,16 @@ export const RoverMap: Partial = { } ) => { this.candidatePathLayer.clearLayers() - if (!candidate || !paths || paths.length === 0) return + + if (!candidate) { + if (this.selectedCandidateMarker) { + this.map.removeLayer(this.selectedCandidateMarker) + this.selectedCandidateMarker = null + } + return + } + + if (!paths || paths.length === 0) return for (const p of paths) { L.polyline( diff --git a/lib/microwaveprop_web/live/rover_live.ex b/lib/microwaveprop_web/live/rover_live.ex index 0e6ddecf..1bcf9912 100644 --- a/lib/microwaveprop_web/live/rover_live.ex +++ b/lib/microwaveprop_web/live/rover_live.ex @@ -320,6 +320,7 @@ defmodule MicrowavepropWeb.RoverLive do socket |> assign(top_candidates: cands, selected_candidate: nil, scoring_loading: false) |> apply_scoring_warnings(warnings) + |> push_event("candidate_paths", %{candidate: nil, paths: []}) |> push_event("rover_results", %{ cells: cells, drive_radius_km: socket.assigns.drive_radius_km