mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-23 17:01:29 +02:00
[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.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user