mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 21:33:00 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -848,6 +848,39 @@ 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() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@@ -856,39 +889,6 @@ window.checkGitHubAuthStatus = function checkGitHubAuthStatus() {
|
|||||||
// Local variables for this instance
|
// Local variables for this instance
|
||||||
let installedPlugins = [];
|
let installedPlugins = [];
|
||||||
window.currentPluginConfig = null;
|
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 onDemandStatusInterval = null;
|
||||||
let currentOnDemandPluginId = null;
|
let currentOnDemandPluginId = null;
|
||||||
let hasLoadedOnDemandStatus = false;
|
let hasLoadedOnDemandStatus = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user