Skip to content

Commit

Permalink
Relay Lists: Reset edit state when changing pages. fixes #628
Browse files Browse the repository at this point in the history
  • Loading branch information
bu5hm4nn committed Feb 3, 2024
1 parent 6fd1a41 commit 617079f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions gossip-bin/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ impl GossipUi {
| Page::RelaysCoverage
| Page::RelaysMine
| Page::RelaysKnownNetwork => {
self.relays.enter_page();
self.open_menu(ctx, SubMenu::Relays);
}
Page::Search => {
Expand Down
10 changes: 10 additions & 0 deletions gossip-bin/src/ui/relays/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ impl RelayUi {
new_relay_url: RELAY_URL_PREPOPULATE.to_string(),
}
}

pub(super) fn enter_page(&mut self) {
// preserve search and filter but reset edits and dialogues
self.edit = None;
self.edit_relays = Vec::new();
self.edit_done = None;
self.edit_needs_scroll = false;
self.add_dialog_step = AddRelayDialogStep::Inactive;
self.new_relay_url = RELAY_URL_PREPOPULATE.to_string();
}
}

#[derive(PartialEq, Default)]
Expand Down

0 comments on commit 617079f

Please sign in to comment.