diff --git a/dashboard/src/ui/mod.rs b/dashboard/src/ui/mod.rs index bec5a85..1e36bf1 100644 --- a/dashboard/src/ui/mod.rs +++ b/dashboard/src/ui/mod.rs @@ -146,8 +146,9 @@ impl TuiApp { if !self.available_hosts.is_empty() { if self.available_hosts.contains(&localhost) && !self.user_navigated_away { // Localhost is available and user hasn't navigated away - switch to it - self.current_host = Some(localhost); - self.host_index = 0; // localhost is always first in sorted_hosts + self.current_host = Some(localhost.clone()); + // Find the actual index of localhost in the sorted list + self.host_index = self.available_hosts.iter().position(|h| h == &localhost).unwrap_or(0); } else if self.current_host.is_none() { // No current host - select first available (which is localhost if available) self.current_host = Some(self.available_hosts[0].clone());