From 83fa9a9c924bb1326b859f1d2d5aac58c291e960 Mon Sep 17 00:00:00 2001 From: jp1ac4 <121959000+jp1ac4@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:19:51 +0000 Subject: [PATCH] gui: unset amount left to select if form invalid --- gui/src/app/state/spend/step.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gui/src/app/state/spend/step.rs b/gui/src/app/state/spend/step.rs index ff575cf9..37be938d 100644 --- a/gui/src/app/state/spend/step.rs +++ b/gui/src/app/state/spend/step.rs @@ -192,6 +192,13 @@ impl DefineSpend { /// if the user did not select a coin manually fn redraft(&mut self, daemon: Arc) { if !self.form_values_are_valid() || self.exists_duplicate() || self.recipients.is_empty() { + // The current form details are not valid to draft a spend, so remove any previously + // calculated amount as it will no longer be valid and could be misleading, e.g. if + // the user removes the amount from one of the recipients. + // We can leave any coins selected as they will either be automatically updated + // as soon as the form is valid or the user has selected these specific coins and + // so we should not touch them. + self.amount_left_to_select = None; return; }