tray: re-enable Exit Node menu item when candidates arrive post-connect

The parent Exit Node item's enablement was only refreshed on icon/status
transitions. The daemon ships peer routes in a later snapshot than the
Connected status text, so after a profile switch the candidate list flips
empty to non-empty while the status string is unchanged — leaving the item
greyed and the freshly painted rows unreachable. Re-evaluate enablement in
the exitNodesChanged branch too.
This commit is contained in:
Zoltan Papp
2026-05-26 23:13:34 +02:00
parent 80d6df6260
commit 61aa3a53ed

View File

@@ -727,6 +727,18 @@ func (t *Tray) applyStatus(st services.Status) {
go t.loadProfiles()
}
if exitNodesChanged {
// Re-evaluate the parent item's enablement here too, not only in
// the iconChanged block above: the daemon ships peer routes in a
// later snapshot than the Connected status text (networks=[] first,
// then populated), so the candidate list can flip empty→non-empty
// while the status string is unchanged. Without this the parent
// "Exit Node" item stays greyed from when it was last set on the
// status transition and the freshly painted rows are unreachable.
// Set before rebuildExitNodes' SetMenu so the rebuild reads the
// updated enabled state at NSMenuItem construction time.
if t.exitNodeItem != nil {
t.exitNodeItem.SetEnabled(connected && len(exitNodes) > 0)
}
t.rebuildExitNodes(exitNodes)
}
if daemonVersionChanged && t.daemonVersionItem != nil {