[object Object]

← back to Hospitalitywallpaper

fix /api/facets total: count the niche-filtered list users see, not the raw catalog

06046ea7bffd1c5b080e3bb04e4d90ad8f982936 · 2026-05-25 21:12:26 -0700 · Steve

Files touched

Diff

commit 06046ea7bffd1c5b080e3bb04e4d90ad8f982936
Author: Steve <steve@designerwallcoverings.com>
Date:   Mon May 25 21:12:26 2026 -0700

    fix /api/facets total: count the niche-filtered list users see, not the raw catalog
---
 server.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/server.js b/server.js
index d9a5a2c..9883d93 100644
--- a/server.js
+++ b/server.js
@@ -185,7 +185,9 @@ 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 });
+  // total reflects the FILTERED (niche) list — what users actually see in the
+  // grid. Previously emitted PRODUCTS.length which overcounted by the niche drop.
+  res.json({ aesthetics, vendors, total: PRODUCTS_NICHE.length });
 });
 
 app.get('/api/health', (req, res) => res.json({ status: 'ok', count: PRODUCTS_NICHE.length, dropped: DROPPED }));

← 7c6f0d2 wire api-vendor-redact middleware (top of stack, defense-in-  ·  back to Hospitalitywallpaper  ·  add 404-guard for .bak/.pre-* paths + clean-URL routes for / 9e5968f →