feat(rover): clear selected candidate + path lines on recalculate

This commit is contained in:
Graham McIntire 2026-04-26 09:56:55 -05:00
parent 556967db5a
commit 2f46d49016
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59
2 changed files with 11 additions and 1 deletions

View file

@ -276,7 +276,16 @@ export const RoverMap: Partial<RoverMapHook> = {
}
) => {
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(

View file

@ -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