Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

fix: keep disposed Radio disclosures inert

Sameh Khamis53c510fe9f0f
diff --git a/src/ui/radioBindings.js b/src/ui/radioBindings.js
index 530e4b43e..68ee78fa8 100644
--- a/src/ui/radioBindings.js
+++ b/src/ui/radioBindings.js
@@ -10,6 +10,7 @@ export function bindRadioControls() {
if (!this._radioPanel) return;
const tunerListenerOptions = {};
const setRadioDisclosure = (expanded, { returnFocus = false } = {}) => {
+ if (this.destroyed) return;
const open = Boolean(expanded);
this._contextRadioDock?.classList.toggle('disclosure-open', open);
if (this._contextRadioMini) this._contextRadioMini.hidden = !open;
@@ -23,6 +24,7 @@ export function bindRadioControls() {
expanded,
{ returnFocus = false } = {},
) => {
+ if (this.destroyed) return;
const displayOpen = kind === 'display' && Boolean(expanded);
const radioOpen = kind === 'radio' && Boolean(expanded);
if (displayOpen || radioOpen) this.actions.setSignalCollapsed(true);
diff --git a/src/ui/radioControls.js b/src/ui/radioControls.js
index df2cc3b2b..8a60898e2 100644
--- a/src/ui/radioControls.js
+++ b/src/ui/radioControls.js
@@ -156,7 +156,7 @@ export class RadioControls {
/** Keep the Context header Radio shortcut truthful for its current route. */
_syncContextRadioLauncherState() {
- if (!this._contextRadioToggleBtn) return;
+ if (this.destroyed || !this._contextRadioToggleBtn) return;
const contextPanel = document.getElementById('global-context-panel');
const contextExpanded = Boolean(
contextPanel && !contextPanel.classList.contains('collapsed'),
diff --git a/src/ui/radioControls.test.mjs b/src/ui/radioControls.test.mjs
index 5bbb88fef..b99c96a18 100644
--- a/src/ui/radioControls.test.mjs
+++ b/src/ui/radioControls.test.mjs
@@ -102,6 +102,8 @@ test('Radio listeners and subscriptions are revoked once before tuning teardown'
f.controls.destroy();
f.controls.destroy();
const snapshot = structuredClone(f.calls);
+ f.controls._setRadioDisclosure(true);
+ f.controls._setCockpitDisclosure('display', true);
f.next.dispatchEvent(new Event('click'));
f.document.dispatchEvent(new Event('gev:radio-selected'));
f.subscribers[0]({ enabled: true });