{
+ const el = $el;
+ const pid = plugin.id;
+ const loadContent = (retries) => {
+ if (window.htmx && !el.dataset.htmxLoaded) {
+ el.dataset.htmxLoaded = 'true';
+ htmx.ajax('GET', '/v3/partials/plugin-config/' + pid, {target: el, swap: 'innerHTML'});
+ } else if (!window.htmx && retries < 15) {
+ setTimeout(() => loadContent(retries + 1), 200);
+ } else if (!window.htmx) {
+ fetch('/v3/partials/plugin-config/' + pid)
+ .then(r => r.text())
+ .then(html => { el.innerHTML = html; });
+ }
+ };
+ loadContent(0);
})">
@@ -3066,13 +3089,25 @@
if (window.Alpine) {
// Use requestAnimationFrame for immediate execution without blocking
requestAnimationFrame(() => {
+ if (window._appEnhanced) return;
+ window._appEnhanced = true;
const appElement = document.querySelector('[x-data]');
if (appElement && appElement._x_dataStack && appElement._x_dataStack[0]) {
const existingComponent = appElement._x_dataStack[0];
+ // Preserve runtime state that should not be reset
+ const preservedPlugins = existingComponent.installedPlugins;
+ const preservedTab = existingComponent.activeTab;
// Replace all properties and methods from full implementation
Object.keys(fullImplementation).forEach(key => {
existingComponent[key] = fullImplementation[key];
});
+ // Restore runtime state if non-default
+ if (preservedPlugins && preservedPlugins.length > 0) {
+ existingComponent.installedPlugins = preservedPlugins;
+ }
+ if (preservedTab && preservedTab !== 'overview') {
+ existingComponent.activeTab = preservedTab;
+ }
// Call init to load plugins and set up watchers (only if not already initialized)
if (typeof existingComponent.init === 'function' && !existingComponent._initialized) {
existingComponent.init();