Skip to content

Commit

Permalink
Revert ctx state for remote backend when user clicks on previous
Browse files Browse the repository at this point in the history
  • Loading branch information
edouardparis committed Aug 20, 2024
1 parent e394963 commit deb8be3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gui/src/installer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ impl Installer {
{
self.current -= 1;
}

if let Some(step) = self.steps.get(self.current) {
step.revert(&mut self.context)
}
}

pub fn new(
Expand Down
6 changes: 6 additions & 0 deletions gui/src/installer/step/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ impl Step for ChooseBackend {
true
}

/// If user clicks on previous to get back to the select backend, we revert the applied remote
/// backend on the context.
fn revert(&self, ctx: &mut Context) {
ctx.remote_backend = None;
}

fn view<'a>(
&'a self,
_hws: &'a HardwareWallets,
Expand Down
1 change: 1 addition & 0 deletions gui/src/installer/step/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub trait Step {
fn apply(&mut self, _ctx: &mut Context) -> bool {
true
}
fn revert(&self, _ctx: &mut Context) {}
fn stop(&self) {}
}

Expand Down

0 comments on commit deb8be3

Please sign in to comment.