From c296c03ee5a9284689df523dc2a27bee0b21b824 Mon Sep 17 00:00:00 2001 From: maxsoch Date: Mon, 6 Jul 2026 22:28:17 +0200 Subject: [PATCH] update menu and count before auto-upgrade starts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fetchOutdated returned before refreshing the UI when auto-upgrade triggered, so the menu showed stale state for the whole upgrade. Now the fetched list lands in the menu, status line and menu bar count first; runAutoUpgrade then overwrites the status with its own message. Notification stays after the post-upgrade refetch — leftovers only. Co-Authored-By: Claude Fable 5 --- BrewBar/BrewBarApp.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/BrewBar/BrewBarApp.swift b/BrewBar/BrewBarApp.swift index 12b4d12..2f76d0c 100644 --- a/BrewBar/BrewBarApp.swift +++ b/BrewBar/BrewBarApp.swift @@ -266,6 +266,12 @@ class AppDelegate: NSObject, NSApplicationDelegate { self.cachedOutdated = outdated + // reflect what was found before any auto-upgrade starts, so the + // menu shows the real list while the upgrade is running + self.updateOutdatedMenu(with: outdated) + self.updateStatus(count: outdated.count) + self.updateMenuBarCount() + // only trigger for the kinds that are both enabled AND outdated — // e.g. an outdated cask must not start a pointless formulae upgrade let upgradeFormulae = Settings.autoUpgradeFormulae && !outdated.formulae.isEmpty @@ -275,9 +281,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { return } - self.updateOutdatedMenu(with: outdated) - self.updateStatus(count: outdated.count) - self.updateMenuBarCount() + // notify only about what auto-upgrade didn't (or couldn't) handle self.notifyIfNeeded(outdated: outdated.all.map(\.name)) if outdated.isEmpty { self.setMenuBarIcon("brewbar-uptodate")