From 679d9cc2fe7299a8af542ef3b7fafcd7f26a49b3 Mon Sep 17 00:00:00 2001 From: Chuck Date: Wed, 18 Feb 2026 16:14:41 -0500 Subject: [PATCH] fix(store): move storeFilterState to global scope to fix scoping bug storeFilterState, pluginStoreCache, and related variables were declared inside an IIFE but referenced by top-level functions, causing ReferenceError that broke all plugin loading. Co-Authored-By: Claude Opus 4.6 --- web_interface/static/v3/plugins_manager.js | 68 +++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/web_interface/static/v3/plugins_manager.js b/web_interface/static/v3/plugins_manager.js index d737f8e6..7f406f0e 100644 --- a/web_interface/static/v3/plugins_manager.js +++ b/web_interface/static/v3/plugins_manager.js @@ -848,47 +848,47 @@ window.checkGitHubAuthStatus = function checkGitHubAuthStatus() { }); }; +// ── Plugin Store State (global scope for access by top-level functions) ────── +var pluginStoreCache = null; +var cacheTimestamp = null; +var CACHE_DURATION = 5 * 60 * 1000; // 5 minutes +var storeFilteredList = []; +var storeFilterState = { + sort: localStorage.getItem('storeSort') || 'a-z', + filterCategory: '', + filterInstalled: null, + searchQuery: '', + page: 1, + perPage: parseInt(localStorage.getItem('storePerPage')) || 12, + persist: function() { + localStorage.setItem('storeSort', this.sort); + localStorage.setItem('storePerPage', this.perPage); + }, + reset: function() { + this.sort = 'a-z'; + this.filterCategory = ''; + this.filterInstalled = null; + this.searchQuery = ''; + this.page = 1; + }, + activeCount: function() { + var n = 0; + if (this.searchQuery) n++; + if (this.filterInstalled !== null) n++; + if (this.filterCategory) n++; + if (this.sort !== 'a-z') n++; + return n; + } +}; + (function() { 'use strict'; if (_PLUGIN_DEBUG_EARLY) console.log('Plugin manager script starting...'); - + // Local variables for this instance let installedPlugins = []; window.currentPluginConfig = null; - let pluginStoreCache = null; // Cache for plugin store to speed up subsequent loads - let cacheTimestamp = null; - const CACHE_DURATION = 5 * 60 * 1000; // 5 minutes in milliseconds - let storeFilteredList = []; - - // ── Plugin Store Filter State ─────────────────────────────────────────── - const storeFilterState = { - sort: localStorage.getItem('storeSort') || 'a-z', - filterCategory: '', - filterInstalled: null, // null=all, true=installed, false=not-installed - searchQuery: '', - page: 1, - perPage: parseInt(localStorage.getItem('storePerPage')) || 12, - persist() { - localStorage.setItem('storeSort', this.sort); - localStorage.setItem('storePerPage', this.perPage); - }, - reset() { - this.sort = 'a-z'; - this.filterCategory = ''; - this.filterInstalled = null; - this.searchQuery = ''; - this.page = 1; - }, - activeCount() { - let n = 0; - if (this.searchQuery) n++; - if (this.filterInstalled !== null) n++; - if (this.filterCategory) n++; - if (this.sort !== 'a-z') n++; - return n; - } - }; let onDemandStatusInterval = null; let currentOnDemandPluginId = null; let hasLoadedOnDemandStatus = false;