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