[object Object]

← back to Hotelwallcoverings

fix non-functional sort select — pass state.sort to /api/products

4b37eda2bcc7ac43630f86c3c1bd4341653330a0 · 2026-05-18 20:38:55 -0700 · Steve Abrams

Files touched

Diff

commit 4b37eda2bcc7ac43630f86c3c1bd4341653330a0
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon May 18 20:38:55 2026 -0700

    fix non-functional sort select — pass state.sort to /api/products
---
 public/index.html | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/public/index.html b/public/index.html
index 555a84d..65d7bb0 100644
--- a/public/index.html
+++ b/public/index.html
@@ -427,7 +427,7 @@ textarea:focus-visible,
 </script>
 
 <script>
-const state = { q:'', facet:'all', page:1, pages:1, total:0, loading:false, exhausted:false };
+const state = { q:'', facet:'all', page:1, pages:1, total:0, loading:false, exhausted:false, sort:'newest' };
 const LABELS = {"all":"All"};
 
 function escAttr(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;' }[c])); }
@@ -540,6 +540,7 @@ async function loadGridPage() {
   const params = new URLSearchParams({ page:state.page, limit:24 });
   if (state.q) params.set('q', state.q);
   if (state.facet !== 'all') params.set('aesthetic', state.facet);
+  if (state.sort && state.sort !== 'newest') params.set('sort', state.sort);
   let data;
   try {
     const r = await fetch('/api/products?' + params);

← 614017e fix /api/facets total to report niche-filtered count, not pr  ·  back to Hotelwallcoverings  ·  untrack 20 stale .bak/.pre snapshot files (18 in public/ — s 63c4b4f →