← back to Raffiawalls
fix /api/facets: use railFacets (productInRail) for aesthetic counts to match filter logic that checks tags+aesthetic field (TK-10119)
f64e044e5dde3cef096223c2e6a669f778865f69 · 2026-08-03 04:08:36 -0700 · Steve
Files touched
Diff
commit f64e044e5dde3cef096223c2e6a669f778865f69
Author: Steve <steve@designerwallcoverings.com>
Date: Mon Aug 3 04:08:36 2026 -0700
fix /api/facets: use railFacets (productInRail) for aesthetic counts to match filter logic that checks tags+aesthetic field (TK-10119)
---
server.js | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/server.js b/server.js
index 94f4bf2..f35f0e6 100644
--- a/server.js
+++ b/server.js
@@ -238,14 +238,12 @@ app.get('/api/sliders', (req, res) => {
app.get('/api/facets', (req, res) => {
// Drill-down counts: each facet dimension is counted over the set narrowed by
- // the OTHER active facets (so the numbers reflect what's reachable given the
- // current selection, not the unfiltered catalog). total = fully-filtered set.
+ // the OTHER active facets. Aesthetic counts use railFacets (productInRail — checks
+ // both p.aesthetic field AND tags) to match the filter logic in /api/products.
const { q, aesthetic, vendor } = req.query;
const sel = { q, aesthetic, vendor };
- const aesthetics = {}; const vendors = {};
- for (const p of filterProducts(PRODUCTS, sel, 'aesthetic')) {
- aesthetics[p.aesthetic] = (aesthetics[p.aesthetic] || 0) + 1;
- }
+ const aesthetics = railFacets(filterProducts(PRODUCTS, sel, 'aesthetic'), SITE_RAILS, RAIL_SYN);
+ const vendors = {};
for (const p of filterProducts(PRODUCTS, sel, 'vendor')) {
vendors[p.vendor] = (vendors[p.vendor] || 0) + 1;
}
← 99ec7e4 raffiawalls: adopt href-to-deeper-data storefront primitives
·
back to Raffiawalls
·
Wire DW Meta Pixel 1431180262113856 + DW-network ad slot [ad 7837cb6 →