From 5ae800492f5aecb14ac58485b0131d7545b6dba8 Mon Sep 17 00:00:00 2001 From: Chuck Date: Thu, 30 Apr 2026 11:52:35 -0400 Subject: [PATCH] fix(plugins): use cached store on HTMX re-swap; reserve searchPluginStore(true) for first load searchPluginStore(true) bypasses the isCacheValid check unconditionally, so every tab revisit was hitting the GitHub commit-info API even within the 5-minute cache window. Set window.pluginManager._reswap = true in the htmx:afterSwap handler and read it in initializePlugins() to call searchPluginStore(false) on re-swaps (respects the 5-minute cache) vs searchPluginStore(true) on first load (always fetches fresh). Explicit user refresh via refreshPlugins() already calls searchPluginStore(true) directly. Co-Authored-By: Claude Sonnet 4.6 --- web_interface/static/v3/plugins_manager.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web_interface/static/v3/plugins_manager.js b/web_interface/static/v3/plugins_manager.js index bea5f831..66ef498a 100644 --- a/web_interface/static/v3/plugins_manager.js +++ b/web_interface/static/v3/plugins_manager.js @@ -1168,6 +1168,7 @@ function initializePluginPageWhenReady() { // 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); } @@ -1212,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');