From 7f13cdf08ab0445634b7f4127c77f5dd610a2939 Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Sun, 22 Mar 2026 00:00:49 +0100 Subject: [PATCH] [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 Signed-off-by: Stan Grams --- src/trx-client/trx-frontend/trx-frontend-http/src/api.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/trx-client/trx-frontend/trx-frontend-http/src/api.rs b/src/trx-client/trx-frontend/trx-frontend-http/src/api.rs index 78f21c6..3e3f99e 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/src/api.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/src/api.rs @@ -1606,15 +1606,14 @@ pub async fn select_rig( ))); } - if let Ok(mut active) = context.remote_active_rig_id.lock() { - *active = Some(rig_id.to_string()); - } - - // Update per-session rig selection if session_id is provided. + // Update per-session rig selection if session_id is provided, otherwise + // update the global default (for non-session-aware clients). if let Some(ref sid) = query.session_id { if let Ok(uuid) = Uuid::parse_str(sid) { 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