fix(bandmap): refresh spot colours when the band map is the visible panel

The post-QSO status refresh was gated on the DX-cluster list being on screen; the band map draws the same statuses and was left out. Working a station in the ordinary layout - Recent QSOs left, docked band map right - left its pill NEW until the cluster tab happened to be opened. Reported on an E51 that stayed orange with the QSO already in the log.
This commit is contained in:
2026-08-10 08:51:06 +02:00
parent 0ec855d95a
commit e51abd262e
2 changed files with 20 additions and 9 deletions
+16 -9
View File
@@ -1640,23 +1640,30 @@ export default function App() {
}, []);
// After a QSO is logged, refresh the shown spots so a call/entity/POTA/prefix/
// slot just worked drops its NEW badge — WITHOUT blanking the others (see the
// merge above). Kept cheap: only while the cluster is on screen (a log while
// hidden marks it dirty and refreshes ONCE on next open), and debounced so a
// fast run coalesces instead of re-scanning per QSO.
const clusterVisibleRef = useRef(false);
// merge above). Kept cheap: only while something that DRAWS a spot status is on
// screen (a log while hidden marks it dirty and refreshes ONCE on the next
// open), and debounced so a fast run coalesces instead of re-scanning per QSO.
//
// "Something" means the band map as much as the cluster list. The test used to
// name only the cluster, so working a station while the docked band map was up
// — the ordinary layout: Recent QSOs on the left, band map on the right — left
// its pill NEW until the cluster tab happened to be opened. Reported on an E51
// that stayed orange after the QSO was in the log.
const spotsVisibleRef = useRef(false);
const spotsDirtyRef = useRef(false);
useEffect(() => {
const vis = mainPaneLeft === 'cluster' || mainPaneRight === 'cluster' || activeTab === 'cluster';
if (vis && !clusterVisibleRef.current && spotsDirtyRef.current) {
const vis = mainPaneLeft === 'cluster' || mainPaneRight === 'cluster'
|| activeTab === 'cluster' || activeTab === 'bandmap' || showBandMap;
if (vis && !spotsVisibleRef.current && spotsDirtyRef.current) {
spotsDirtyRef.current = false;
void refreshSpotStatuses();
}
clusterVisibleRef.current = vis;
}, [mainPaneLeft, mainPaneRight, activeTab, refreshSpotStatuses]);
spotsVisibleRef.current = vis;
}, [mainPaneLeft, mainPaneRight, activeTab, showBandMap, refreshSpotStatuses]);
useEffect(() => {
let t: number | undefined;
const off = EventsOn('qso:logged', () => {
if (!clusterVisibleRef.current) { spotsDirtyRef.current = true; return; }
if (!spotsVisibleRef.current) { spotsDirtyRef.current = true; return; }
if (t) window.clearTimeout(t);
t = window.setTimeout(() => void refreshSpotStatuses(), 2000);
});