[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:
@@ -3349,25 +3349,18 @@ async function switchRigFromSelect(selectEl) {
|
|||||||
showHint("Unknown rig", 1500);
|
showHint("Unknown rig", 1500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectEl.disabled = true;
|
// Rig selection is purely client-side: set the per-tab rig_id so all
|
||||||
// Set per-tab rig immediately so subsequent commands target the new rig.
|
// subsequent commands target this rig. No server call needed — postPath()
|
||||||
|
// auto-appends rig_id to every request.
|
||||||
const prevRig = lastActiveRigId;
|
const prevRig = lastActiveRigId;
|
||||||
lastActiveRigId = selectEl.value;
|
lastActiveRigId = selectEl.value;
|
||||||
if (prevRig && prevRig !== lastActiveRigId) {
|
if (prevRig && prevRig !== lastActiveRigId) {
|
||||||
resetDecoderStateOnRigSwitch();
|
resetDecoderStateOnRigSwitch();
|
||||||
}
|
}
|
||||||
showHint("Switching rig…");
|
updateRigSubtitle(lastActiveRigId);
|
||||||
try {
|
if (typeof setSchedulerRig === "function") setSchedulerRig(lastActiveRigId);
|
||||||
await postPath(`/select_rig?rig_id=${encodeURIComponent(selectEl.value)}`);
|
if (typeof setBackgroundDecodeRig === "function") setBackgroundDecodeRig(lastActiveRigId);
|
||||||
refreshRigList();
|
showHint(`Rig: ${lastActiveRigId}`, 1500);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (headerRigSwitchSelect) {
|
if (headerRigSwitchSelect) {
|
||||||
|
|||||||
Reference in New Issue
Block a user