fix(cat): the settings panel opens on the radio that is actually active

The loader looked for an 'active' flag the radio list has never carried, so
reopening the panel always landed on the first entry — Radio 1's name over
whichever radio's settings were live, and every field edit (MY_RIG included)
silently rewriting the wrong entry. The backend is the only one who knows
which radio is on the air; ask it.
This commit is contained in:
2026-08-29 15:52:37 +02:00
parent ffbbff80d6
commit 6d4a110949
2 changed files with 13 additions and 5 deletions
+9 -3
View File
@@ -9,7 +9,7 @@ import {
import {
GetLookupSettings, SaveLookupSettings, ClearLookupCache, TestLookupProvider,
GetListsSettings, SaveListsSettings,
GetCATSettings, SaveCATSettings, GetRadios, SaveRadios, SetActiveRadio, DiscoverFlexRadios,
GetCATSettings, SaveCATSettings, GetRadios, SaveRadios, SetActiveRadio, ActiveRadioID, DiscoverFlexRadios,
ListProfiles, GetActiveProfile, SaveProfile, DeleteProfile, ActivateProfile, DuplicateProfile,
GetRotators, SaveRotators, TestRotatorDevice, RotatorPark, RotatorStop,
GetRotorPresets, SaveRotorPresets, ResetRotorPresets,
@@ -2206,8 +2206,14 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
try {
const rl: any = await GetRadios();
setRadios(rl ?? []);
const act = (rl ?? []).find((r: any) => r.active) ?? (rl ?? [])[0];
setActiveRadioId(act?.id ?? '');
// The backend is the only one who knows which radio is on the air —
// the list entries carry no 'active' flag, and guessing the first
// meant reopening the panel showed Radio 1's name over the settings
// of whichever radio was actually selected.
let actId = '';
try { actId = (await ActiveRadioID()) ?? ''; } catch {}
if (!actId || !(rl ?? []).some((r: any) => r.id === actId)) actId = (rl ?? [])[0]?.id ?? '';
setActiveRadioId(actId);
} catch { /* one radio, never listed — the panel works as it always did */ }
try { setUltrabeam(await GetUltrabeamSettings() as any); } catch {}
try { setAntgenius(await GetAntGeniusSettings() as any); } catch {}