diff --git a/web_interface/static/v3/plugins_manager.js b/web_interface/static/v3/plugins_manager.js index 0f15b33c..66ef498a 100644 --- a/web_interface/static/v3/plugins_manager.js +++ b/web_interface/static/v3/plugins_manager.js @@ -1165,9 +1165,11 @@ function initializePluginPageWhenReady() { if (target.id === 'plugins-content' || target.querySelector('#installed-plugins-grid')) { console.log('HTMX swap detected for plugins, initializing...'); - // Reset initialization flag to allow re-initialization after HTMX swap + // Reset all initialization flags so the fresh empty DOM gets populated window.pluginManager.initialized = false; window.pluginManager.initializing = false; + window.pluginManager._reswap = true; // signal: use cached store, don't re-fetch GitHub + pluginsInitialized = false; initTimer = setTimeout(attemptInit, 100); } }, { once: false }); // Allow multiple swaps @@ -1211,9 +1213,13 @@ function initializePlugins() { console.warn('[INIT] checkGitHubAuthStatus not available yet'); } - // Load both installed plugins and plugin store + // Load both installed plugins and plugin store. + // On HTMX re-swaps use cached store data (fetchCommitInfo=false) to avoid + // re-hitting GitHub on every tab switch; only fetch fresh on first load. + const isReswap = !!window.pluginManager._reswap; + window.pluginManager._reswap = false; loadInstalledPlugins(); - searchPluginStore(true); // Load plugin store with fresh metadata from GitHub + searchPluginStore(!isReswap); // Setup search functionality (with guard against duplicate listeners) const searchInput = document.getElementById('plugin-search'); @@ -5127,7 +5133,7 @@ function refreshPlugins() { pluginStoreCache = null; cacheTimestamp = null; - loadInstalledPlugins(); + refreshInstalledPlugins(); // invalidates cache before fetching // Fetch latest metadata from GitHub when refreshing searchPluginStore(true); showNotification('Plugins refreshed with latest metadata from GitHub', 'success');