[fix](trx-frontend-http): make rig switch purely client-side, no /select_rig call

The /select_rig endpoint sets global server state which affects all tabs. Since postPath() already sends rig_id with every command, the rig picker now just sets the local lastActiveRigId variable.

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-21 23:07:36 +01:00
parent 3412827704
commit 5a12a321b2
@@ -3349,25 +3349,18 @@ async function switchRigFromSelect(selectEl) {
showHint("Unknown rig", 1500);
return;
}
selectEl.disabled = true;
// Set per-tab rig immediately so subsequent commands target the new rig.
// Rig selection is purely client-side: set the per-tab rig_id so all
// subsequent commands target this rig. No server call needed — postPath()
// auto-appends rig_id to every request.
const prevRig = lastActiveRigId;
lastActiveRigId = selectEl.value;
if (prevRig && prevRig !== lastActiveRigId) {
resetDecoderStateOnRigSwitch();
}
showHint("Switching rig…");
try {
await postPath(`/select_rig?rig_id=${encodeURIComponent(selectEl.value)}`);
refreshRigList();
showHint("Rig switch requested", 1500);
} catch (err) {
showHint("Rig switch failed", 2000);
console.error(err);
} finally {
const disableSwitch = lastRigIds.length === 0 || !authRole || authRole === "rx";
selectEl.disabled = disableSwitch;
}
updateRigSubtitle(lastActiveRigId);
if (typeof setSchedulerRig === "function") setSchedulerRig(lastActiveRigId);
if (typeof setBackgroundDecodeRig === "function") setBackgroundDecodeRig(lastActiveRigId);
showHint(`Rig: ${lastActiveRigId}`, 1500);
}
if (headerRigSwitchSelect) {