fix(sat): saving the settings refreshes the Satellites tab
The tab read the followed list, the horizon and the locator once, when it was mounted. It is normally open BEHIND the settings window while those are edited, so un-following QO-100 left it in the pass table and in the dropdown until the tab was reopened — indistinguishable, from the outside, from a setting that had not saved at all. SaveSatSettings now emits sat:settings, and the panel reloads the birds and the passes on it, the same way it already does on sat:tle. One event for every key: they all change what the tab should be showing. The selection needs nothing new — a satellite that has stopped being followed drops out of the dropdown, and the effect that keeps the selection inside that list moves to the first one remaining.
This commit is contained in:
@@ -306,6 +306,12 @@ export function SatellitePanel({ myGrid }: { myGrid: string }) {
|
||||
|
||||
useEffect(() => { loadBirds(); loadTle(); loadPasses(); }, [loadBirds, loadTle, loadPasses]);
|
||||
useEffect(() => EventsOn('sat:tle', () => { loadTle(); loadBirds(); loadPasses(); }), [loadTle, loadBirds, loadPasses]);
|
||||
// Saving the satellite settings. The followed list, the lowest pass and the
|
||||
// locator all change what belongs here, and this tab is normally open behind
|
||||
// the settings window while they are edited. The selection repairs itself:
|
||||
// a satellite that is no longer followed drops out of the dropdown, and the
|
||||
// effect below moves to the first one that is.
|
||||
useEffect(() => EventsOn('sat:settings', () => { loadBirds(); loadPasses(); }), [loadBirds, loadPasses]);
|
||||
useEffect(() => { if (sel) localStorage.setItem('opslog.satSelected', sel); }, [sel]);
|
||||
useEffect(() => { setTpIdx(0); }, [sel]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user