fix(bandopen): stop subscribing to a band nobody watches, and drop the toast
A saved band selection outlives the code that made it. 12 m was removed from the watched set, but every operator who had already enabled the watch kept subscribing to it — paying for a firehose whose messages the detector then threw away. The stored list is filtered against the offered one now. The badge appeared on the next poll rather than on the event, up to twenty seconds after the announcement, so the two read as unrelated things that happened to mention the same band. It appears immediately. And the toast is gone. It said the same thing as the badge and vanished after five seconds — an operator who was tuning when it passed had no way back to it, which is precisely what the badge was built to fix. Keeping both announced an opening twice and still lost it once.
This commit is contained in:
+10
-5
@@ -2126,13 +2126,18 @@ export default function App() {
|
||||
useEffect(() => {
|
||||
const off = EventsOn('bandopen:detected', (o: any) => {
|
||||
if (!o?.band) return;
|
||||
const season = o.in_season ? '' : ` — ${t('bmp.openUnusual')}`;
|
||||
showToast(`📡 ${t('bmp.openToast', {
|
||||
band: String(o.band).toUpperCase(), n: o.calls, km: o.median_km,
|
||||
})}${season}`);
|
||||
// The badge appears on the EVENT, not on the next poll. It used to wait for
|
||||
// one, so the announcement and the badge were up to twenty seconds apart and
|
||||
// read as two unrelated things happening to mention the same band.
|
||||
//
|
||||
// No toast any more: the badge says the same thing and does not vanish after
|
||||
// five seconds. An operator who was tuning when the toast passed had no way
|
||||
// back to it, which is exactly what the badge was built to fix — keeping
|
||||
// both meant announcing an opening twice and still losing it once.
|
||||
setLiveOpenings((cur) => [...cur.filter((x: any) => x.band !== o.band), o]);
|
||||
});
|
||||
return () => { off(); };
|
||||
}, [showToast, t]);
|
||||
}, []);
|
||||
|
||||
// DX-cluster spot alerts: a matched rule fires here. Play a beep (WebAudio, no
|
||||
// asset needed — CSP-safe) and/or show a toast, per the rule's chosen actions.
|
||||
|
||||
Reference in New Issue
Block a user