fix(webui): populate admin sidebar on cold visit

The admin landing (overview) and the tools pages (ssh-access, system) call
populateSidebar() without first loading window.configData. On a cold admin
visit — e.g. navigating straight from the dashboard — configData is undefined,
so populateSidebar() bails early and the sidebar renders empty. Visiting
Backups happened to set window.configData, which is why returning to admin
afterward showed the sidebar.

Load (cached) config data up front in renderConfig before any branch renders so
the sidebar always has its categories. The config-category path's later
loadConfig is now a cache hit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-25 18:13:55 +01:00
parent 6be0db57da
commit 3064328aa8

View File

@ -25,6 +25,13 @@ if (typeof window.ConfigManager === 'undefined') {
return;
}
// The sidebar and page headers read window.configData. Load it up front so
// populateSidebar() has categories on a cold admin visit (e.g. straight
// from the dashboard); otherwise the overview/tools branches below render
// an empty sidebar until something else populates configData. Cached after
// the first call, so the config-category path below is a cache hit.
try { await this.core.loadConfig(category); } catch (e) {}
// Overview is the Admin landing — an ops/health board, not a config form.
if (category === 'overview') {
try { this.sidebar.populateSidebar(); } catch (e) {}