[fix](trx-frontend-http): prevent rig switch from leaking across tabs

select_rig was unconditionally updating the global remote_active_rig_id,
causing all SSE sessions to see the changed rig. Now only the per-session
mapping is updated when session_id is provided; the global default is
only changed for non-session-aware clients.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-22 00:00:49 +01:00
parent 12a3c62917
commit 7f13cdf08a
@@ -1606,15 +1606,14 @@ pub async fn select_rig(
))); )));
} }
if let Ok(mut active) = context.remote_active_rig_id.lock() { // Update per-session rig selection if session_id is provided, otherwise
*active = Some(rig_id.to_string()); // update the global default (for non-session-aware clients).
}
// Update per-session rig selection if session_id is provided.
if let Some(ref sid) = query.session_id { if let Some(ref sid) = query.session_id {
if let Ok(uuid) = Uuid::parse_str(sid) { if let Ok(uuid) = Uuid::parse_str(sid) {
session_rig_mgr.set_rig(uuid, rig_id.to_string()); session_rig_mgr.set_rig(uuid, rig_id.to_string());
} }
} else if let Ok(mut active) = context.remote_active_rig_id.lock() {
*active = Some(rig_id.to_string());
} }
// Broadcast the channel list for the newly selected rig so all SSE // Broadcast the channel list for the newly selected rig so all SSE