debug: add console logging to filter/sort handlers

This commit is contained in:
Chuck
2026-02-16 11:33:25 -05:00
parent 4c2c7c0d17
commit 88c4faa9ac

View File

@@ -5127,16 +5127,20 @@ function restartDisplay() {
// --- Store Filter/Sort Functions --- // --- Store Filter/Sort Functions ---
function setupStoreFilterListeners() { function setupStoreFilterListeners() {
console.log('[FILTER SETUP] setupStoreFilterListeners() called');
// Sort dropdown // Sort dropdown
const sortSelect = document.getElementById('store-sort'); const sortSelect = document.getElementById('store-sort');
console.log('[FILTER SETUP] store-sort element:', !!sortSelect, 'listenerSetup:', sortSelect?._listenerSetup);
if (sortSelect && !sortSelect._listenerSetup) { if (sortSelect && !sortSelect._listenerSetup) {
sortSelect._listenerSetup = true; sortSelect._listenerSetup = true;
sortSelect.value = storeFilterState.sort; sortSelect.value = storeFilterState.sort;
sortSelect.addEventListener('change', () => { sortSelect.addEventListener('change', () => {
console.log('[FILTER] Sort changed to:', sortSelect.value, 'cache:', !!pluginStoreCache);
storeFilterState.sort = sortSelect.value; storeFilterState.sort = sortSelect.value;
storeFilterState.persist(); storeFilterState.persist();
applyStoreFiltersAndSort(); applyStoreFiltersAndSort();
}); });
console.log('[FILTER SETUP] Sort listener attached');
} }
// Verified filter toggle // Verified filter toggle
@@ -5193,9 +5197,11 @@ function setupStoreFilterListeners() {
// Tag pills (event delegation on container) // Tag pills (event delegation on container)
// Category pills (event delegation on container) // Category pills (event delegation on container)
const catsPills = document.getElementById('filter-categories-pills'); const catsPills = document.getElementById('filter-categories-pills');
console.log('[FILTER SETUP] filter-categories-pills element:', catsPills, 'listenerSetup:', catsPills?._listenerSetup);
if (catsPills && !catsPills._listenerSetup) { if (catsPills && !catsPills._listenerSetup) {
catsPills._listenerSetup = true; catsPills._listenerSetup = true;
catsPills.addEventListener('click', (e) => { catsPills.addEventListener('click', (e) => {
console.log('[FILTER] Category pill click, target:', e.target, 'closest:', e.target.closest('.category-filter-pill'));
const pill = e.target.closest('.category-filter-pill'); const pill = e.target.closest('.category-filter-pill');
if (!pill) return; if (!pill) return;
const cat = pill.dataset.category; const cat = pill.dataset.category;
@@ -5207,8 +5213,10 @@ function setupStoreFilterListeners() {
storeFilterState.filterCategories.push(cat); storeFilterState.filterCategories.push(cat);
pill.dataset.active = 'true'; pill.dataset.active = 'true';
} }
console.log('[FILTER] Categories now:', storeFilterState.filterCategories, 'cache size:', pluginStoreCache?.length);
applyStoreFiltersAndSort(); applyStoreFiltersAndSort();
}); });
console.log('[FILTER SETUP] Category pill listener attached');
} }
// Clear filters button // Clear filters button
@@ -5243,7 +5251,8 @@ function setupStoreFilterListeners() {
} }
function applyStoreFiltersAndSort() { function applyStoreFiltersAndSort() {
if (!pluginStoreCache) return; console.log('[FILTER] applyStoreFiltersAndSort called, cache:', pluginStoreCache?.length, 'state:', JSON.stringify(storeFilterState));
if (!pluginStoreCache) { console.log('[FILTER] No cache, returning'); return; }
let plugins = [...pluginStoreCache]; let plugins = [...pluginStoreCache];
const installedIds = new Set( const installedIds = new Set(