chore: add comment around restore profile selection

This commit is contained in:
Gabriele Musco 2023-06-17 22:44:28 +02:00
commit 1b405bc06b
No known key found for this signature in database
GPG key ID: 1068D795C80E51DE

View file

@ -246,6 +246,10 @@ impl SimpleComponent for MainView {
} }
MainViewMsg::UpdateProfileNames(names, config) => { MainViewMsg::UpdateProfileNames(names, config) => {
self.set_profile_names(names); self.set_profile_names(names);
// why send another message to set the dropdown selection?
// set_* from tracker likely updates the view obj in the next
// draw, so selecting here will result in nothing cause the
// dropdown is effectively empty
sender.input(MainViewMsg::SetSelectedProfile({ sender.input(MainViewMsg::SetSelectedProfile({
let pos = self.profile_names.iter() let pos = self.profile_names.iter()
.position(|p| p.clone() == config.selected_profile_name); .position(|p| p.clone() == config.selected_profile_name);