From 661f013a92a0bae7deea2c862c26ec8ff56287fc Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 1 Apr 2026 11:44:16 +0000 Subject: [PATCH] [fix](trx-frontend-http): load scheduler eagerly and auto-init on late load The lazy plugin loader (25c5940) deferred scheduler.js to the 'settings' tab, but initSettingsUI() runs at app boot before the user clicks any tab. This meant initScheduler was undefined at boot, so the scheduler-control-row on the main tab never showed and status polling never started. Two fixes: 1. Add 'settings' to the eagerly-loaded plugin list so scheduler.js and vchan.js load at startup alongside digital-modes and bookmarks. 2. Add auto-init at the end of scheduler.js: if authRole is already set when the script executes (late/lazy load), it self-initializes without waiting for initSettingsUI(). This makes it resilient to any load order. https://claude.ai/code/session_01YNwgQGjCdLjVMcatVy3uQi Signed-off-by: Claude --- .../trx-frontend/trx-frontend-http/assets/web/index.html | 2 +- .../trx-frontend-http/assets/web/plugins/scheduler.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/index.html b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/index.html index 0f3edd2..11eae6d 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/index.html +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/index.html @@ -1583,7 +1583,7 @@ }); } // Load core plugins immediately (needed on main tab) - ['digital-modes', 'bookmarks'].forEach(loadPlugins); + ['digital-modes', 'bookmarks', 'settings'].forEach(loadPlugins); // Load others on tab switch document.addEventListener('click', function(e) { var tab = e.target.closest('[data-tab]'); diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/scheduler.js b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/scheduler.js index c783ec9..f0895f6 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/scheduler.js +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/plugins/scheduler.js @@ -1449,4 +1449,13 @@ window.destroyScheduler = destroyScheduler; window.wireSchedulerEvents = wireSchedulerEvents; window.setSchedulerRig = setSchedulerRig; + + // Auto-initialize if the app has already booted (lazy-load case). + // When loaded eagerly, initSettingsUI() in app.js calls initScheduler(); + // when loaded lazily (e.g. settings tab click after boot), the app has + // already passed that point, so we must self-initialize here. + if (typeof authRole !== "undefined" && authRole !== null) { + initScheduler(typeof lastActiveRigId !== "undefined" ? lastActiveRigId : null, authRole); + wireSchedulerEvents(); + } })();