[object Object]

← back to Retrowalls

fix(api): /api/facets total counts the served niche list, not raw catalog

f782674b833e88f1da8bb7fce38a846012b3d46e · 2026-05-19 15:14:14 -0700 · Steve Abrams

Previously total reflected pre-niche-filter PRODUCTS.length while the
aesthetics/vendors histograms were computed from PRODUCTS_NICHE; clients
saw a "total" that didn't match the sum of facet counts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit f782674b833e88f1da8bb7fce38a846012b3d46e
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue May 19 15:14:14 2026 -0700

    fix(api): /api/facets total counts the served niche list, not raw catalog
    
    Previously total reflected pre-niche-filter PRODUCTS.length while the
    aesthetics/vendors histograms were computed from PRODUCTS_NICHE; clients
    saw a "total" that didn't match the sum of facet counts.
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
 server.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server.js b/server.js
index c40450e..c8fc5c3 100644
--- a/server.js
+++ b/server.js
@@ -173,7 +173,7 @@ app.get('/api/facets', (req, res) => {
     aesthetics[p.aesthetic] = (aesthetics[p.aesthetic] || 0) + 1;
     vendors[p.vendor] = (vendors[p.vendor] || 0) + 1;
   }
-  res.json({ aesthetics, vendors, total: PRODUCTS.length });
+  res.json({ aesthetics, vendors, total: PRODUCTS_NICHE.length });
 });
 
 app.get('/api/health', (req, res) => res.json({ status: 'ok', count: PRODUCTS_NICHE.length, dropped: DROPPED }));

← c0aa94c Phase 2b: harden .card .pat against long-token title clippin  ·  back to Retrowalls  ·  fix(security): 404-guard for .bak/.pre-* editor snapshots in f88113a →