From 75eacfc2a8cb7025f4a8a27d7f873d3b713faefe Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 7 Nov 2026 19:50:28 -0800 Subject: [PATCH] craft-update: an offer after a failed update clears the failure status Updater::offer opens a prompt that carries the failed update's reason, and now sets the status to Idle, as a check that finds a release does. An app that shows CheckResultDialog while the status is not Idle no longer shows the failure card and the prompt at once. --- crates/update/src/updater.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/update/src/updater.rs b/crates/update/src/updater.rs index 0e3bb20d..1cfbe62e 100644 --- a/crates/update/src/updater.rs +++ b/crates/update/src/updater.rs @@ -313,10 +313,12 @@ impl Updater { } /// Opens the startup prompt for a release the app found itself. After a failed update the - /// prompt says why it failed, like the one a check opens. + /// prompt says why it failed, like the one a check opens. Opening the prompt sets + /// [`Self::status`] to [`Status::Idle`]. pub fn offer(&mut self, release: Release) { if self.install.is_none() && !self.installed && !self.read_choice() { self.open_offer(release); + self.status = Status::Idle; } } @@ -1503,6 +1505,7 @@ mod tests { assert_eq!(u.status(), &Status::InstallFailed("disk full".into())); u.offer(newer()); assert_eq!(u.prompt.as_ref().and_then(StartupPrompt::message).as_deref(), Some("The update could not be installed: disk full")); + assert_eq!(u.status(), &Status::Idle, "the prompt carries the reason"); u.prompt = None; u.offer(newer()); assert_eq!(u.prompt.as_ref().and_then(StartupPrompt::message), None, "the reason is shown once");