From b598274424c5f035dedcd001cf1b61497223149d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Mon, 8 Jun 2026 17:26:54 +0200 Subject: [PATCH] [client/ui] Refresh profile list on CLI profile select SwitchProfile now publishes the same profile-list-changed event that AddProfile/RemoveProfile already emit. The daemon emits no dedicated profile RPC event, and the React ProfileContext only refreshes on EventProfileChanged (unlike the tray, which also re-fetches on every status-string transition via loadProfiles). So a CLI-driven "netbird down; profile select X; netbird up" refreshed the tray (the down/up status flips trigger loadProfiles) but left the React profile dropdown stale, since the select path never surfaced an event. Publishing the marked INFO/SYSTEM event from SwitchProfile closes that gap: dispatchSystemEvent re-emits EventProfileChanged, which ProfileContext.refresh already subscribes to. No proto change. --- client/server/server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/server/server.go b/client/server/server.go index 685314819..20f80743e 100644 --- a/client/server/server.go +++ b/client/server/server.go @@ -959,6 +959,10 @@ func (s *Server) SwitchProfile(callerCtx context.Context, msg *proto.SwitchProfi s.config = config + if msg != nil && msg.ProfileName != nil { + s.publishProfileListChanged(*msg.ProfileName) + } + return &proto.SwitchProfileResponse{}, nil }