update menu and count before auto-upgrade starts

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 <noreply@anthropic.com>
This commit is contained in:
maxsoch 2026-07-06 22:28:17 +02:00
parent 813fc47461
commit c296c03ee5

View file

@ -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")