From 2e889c8743556d7ccc31c452899db90585d64ae0 Mon Sep 17 00:00:00 2001 From: ChuckBuilds Date: Mon, 30 Mar 2026 12:32:05 -0400 Subject: [PATCH] fix(web): use runtime default tab and add Alpine.initTree to fetch fallback - Replace hard-coded 'overview' comparison with runtime defaultTab (isAPMode ? 'wifi' : 'overview') in both enhancement paths, so activeTab is preserved correctly in AP mode - Add Alpine.initTree(el) call in the plugin config fetch() fallback so Alpine directives in the injected HTML are initialized, matching the pattern used by loadOverviewDirect and loadWifiDirect Co-Authored-By: Claude Opus 4.6 (1M context) --- web_interface/templates/v3/base.html | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/web_interface/templates/v3/base.html b/web_interface/templates/v3/base.html index 5c856d45..54f8354d 100644 --- a/web_interface/templates/v3/base.html +++ b/web_interface/templates/v3/base.html @@ -546,13 +546,14 @@ // Preserve runtime state that should not be reset const preservedPlugins = this.installedPlugins; const preservedTab = this.activeTab; + const defaultTab = isAPMode ? 'wifi' : 'overview'; const wasInitialized = this._initialized; Object.assign(this, fullApp); // Restore runtime state if non-default if (preservedPlugins && preservedPlugins.length > 0) { this.installedPlugins = preservedPlugins; } - if (preservedTab && preservedTab !== 'overview') { + if (preservedTab && preservedTab !== defaultTab) { this.activeTab = preservedTab; } if (wasInitialized) { @@ -1276,7 +1277,12 @@ } else if (!window.htmx) { fetch('/v3/partials/plugin-config/' + pid) .then(r => r.text()) - .then(html => { el.innerHTML = html; }); + .then(html => { + el.innerHTML = html; + if (window.Alpine) { + window.Alpine.initTree(el); + } + }); } }; loadContent(0); @@ -3091,6 +3097,9 @@ requestAnimationFrame(() => { if (window._appEnhanced) return; window._appEnhanced = true; + const isAPMode = window.location.hostname === '192.168.4.1' || + window.location.hostname.startsWith('192.168.4.'); + const defaultTab = isAPMode ? 'wifi' : 'overview'; const appElement = document.querySelector('[x-data]'); if (appElement && appElement._x_dataStack && appElement._x_dataStack[0]) { const existingComponent = appElement._x_dataStack[0]; @@ -3105,7 +3114,7 @@ if (preservedPlugins && preservedPlugins.length > 0) { existingComponent.installedPlugins = preservedPlugins; } - if (preservedTab && preservedTab !== 'overview') { + if (preservedTab && preservedTab !== defaultTab) { existingComponent.activeTab = preservedTab; } // Call init to load plugins and set up watchers (only if not already initialized)