[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 <noreply@anthropic.com>
This commit is contained in:
@@ -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]');
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user