diff --git a/Cargo.toml b/Cargo.toml index 5bbdabc..c3d14ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "ghost-eye" authors = ["str3tch "] description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost" -version = "0.3.35" +version = "0.3.36" edition = "2021" [dependencies] diff --git a/src/components/nominator/current_validators.rs b/src/components/nominator/current_validators.rs index 2096e29..f29515b 100644 --- a/src/components/nominator/current_validators.rs +++ b/src/components/nominator/current_validators.rs @@ -66,9 +66,14 @@ impl CurrentValidators { fn update_choosen_details(&self, index: usize) { if let Some(action_tx) = &self.action_tx { + let (selected_account_id, selected_points) = self.individual + .get(index) + .map(|data| (data.account_id, data.points)) + .unwrap_or_default(); + let _ = action_tx.send(Action::SetChoosenValidator( - self.individual[index].account_id, - self.individual[index].points, + selected_account_id, + selected_points, self.total_points)); } } @@ -183,13 +188,13 @@ impl CurrentValidators { .position(|item| item.account_id == account_id) { self.individual.swap(0, index); } + let current_index = self.table_state.selected().unwrap_or_default(); + self.table_state.select(Some(current_index)); + self.update_choosen_details(current_index); } } self.scroll_state = self.scroll_state.content_length(self.individual.len()); - if let Some(index) = self.table_state.selected() { - self.update_choosen_details(index); - } } }