From 2995df870f711966d7d275f67de70719dd1498ce Mon Sep 17 00:00:00 2001 From: edouardparis Date: Tue, 5 Mar 2024 12:00:40 +0100 Subject: [PATCH] fix psbts panel: keep list of psbts in background fix this comment: https://github.com/wizardsardine/liana/pull/959#issuecomment-1964811858 new_preselected is changed for a preselect method that keeps the current state of the psbts list panel and open the modal with the selected psbt. --- gui/src/app/mod.rs | 2 +- gui/src/app/state/psbts.rs | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/gui/src/app/mod.rs b/gui/src/app/mod.rs index 2fc2e9ef..0586cec4 100644 --- a/gui/src/app/mod.rs +++ b/gui/src/app/mod.rs @@ -161,7 +161,7 @@ impl App { .list_spend_transactions(Some(&[*txid])) .map(|txs| txs.first().cloned()) { - self.panels.psbts = PsbtsPanel::new_preselected(self.wallet.clone(), spend_tx); + self.panels.psbts.preselect(spend_tx); self.panels.current = menu; return Command::none(); }; diff --git a/gui/src/app/state/psbts.rs b/gui/src/app/state/psbts.rs index 6ba8a8ca..414e639e 100644 --- a/gui/src/app/state/psbts.rs +++ b/gui/src/app/state/psbts.rs @@ -34,16 +34,11 @@ impl PsbtsPanel { } } - pub fn new_preselected(wallet: Arc, spend_tx: SpendTx) -> Self { - let psbt_state = psbt::PsbtState::new(wallet.clone(), spend_tx.clone(), true); - - Self { - wallet, - spend_txs: vec![spend_tx], - warning: None, - selected_tx: Some(psbt_state), - import_tx: None, - } + pub fn preselect(&mut self, spend_tx: SpendTx) { + let psbt_state = psbt::PsbtState::new(self.wallet.clone(), spend_tx, true); + self.selected_tx = Some(psbt_state); + self.warning = None; + self.import_tx = None; } }