From 1b9ea0e8e3f727fe98aa02ebad38ae1c24ff0ba8 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Sun, 13 Sep 2026 01:23:55 -0700 Subject: [PATCH] fix: preserve camera controls when rebuilding the Radio panel --- scripts/qa-camera-controls.mjs | 16 ++++++++++++++++ src/ui.js | 1 - 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/qa-camera-controls.mjs b/scripts/qa-camera-controls.mjs index 78ec1650e..7eb2aeca7 100644 --- a/scripts/qa-camera-controls.mjs +++ b/scripts/qa-camera-controls.mjs @@ -378,6 +378,22 @@ try { return rect.width > 0 && rect.left >= 0 && rect.right <= innerWidth + 1; }), ); + check( + 'rebuilding Radio preserves the active camera controller and subscription', + await page.evaluate(() => { + const ui = window.__godsEyeView.styleManager; + const camera = ui._cctvControls; + const cameraId = camera.getState()?.activeCameraId; + ui._initRadioPanel(); + ui._radioControls.connect(); + return ( + ui._cctvControls === camera && + !camera.destroyed && + Boolean(camera._cctvUnsubscribe) && + camera.getState()?.activeCameraId === cameraId + ); + }), + ); await page.evaluate(() => window.__godsEyeView.styleManager.dispose()); check( 'CCTV controller is destroyed with the real UI', diff --git a/src/ui.js b/src/ui.js index fa0637c2a..844bc3781 100644 --- a/src/ui.js +++ b/src/ui.js @@ -4885,7 +4885,6 @@ export class StyleManager { /** Wire the independent Radio companion controls. */ _initRadioPanel() { - this._cctvControls?.destroy(); this._radioControls?.destroy(); this._radioControls = new RadioControls({ elements: {