← back to Ffepurchasing
WIP: partial sort hydration from killed agent — finish in next pass
084f9b5b4688c86fa4fb89d78d4c3c88308eb526 · 2026-05-19 17:17:24 -0700 · Steve Abrams
Files touched
M .gitignoreM public/index.html
Diff
commit 084f9b5b4688c86fa4fb89d78d4c3c88308eb526
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue May 19 17:17:24 2026 -0700
WIP: partial sort hydration from killed agent — finish in next pass
---
.gitignore | 3 +++
public/index.html | 10 +++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 4cf65fd..1e851f1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,4 +10,7 @@ dist/
build/
.next/
*.bak
+*.bak.*
+*.pre-*
+*.pre-*.bak
.deploy.conf
diff --git a/public/index.html b/public/index.html
index fbbd971..e80ea5f 100644
--- a/public/index.html
+++ b/public/index.html
@@ -613,7 +613,14 @@ 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' };
+// Hydrate saved sort from localStorage BEFORE first /api/products call so the
+// initial grid matches the dropdown's eventual selected value.
+try {
+ const _sortKey = location.hostname.replace(/\./g, '_') + '_sort';
+ const _savedSort = localStorage.getItem(_sortKey);
+ if (_savedSort) state.sort = _savedSort;
+} catch(e){}
const TOUCH = window.matchMedia('(hover: none)').matches;
const LABELS = {"all":"All"};
@@ -721,6 +728,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);
← 2bdb4aa fix: add .bak/.pre-* 404 guard and correct /api/facets total
·
back to Ffepurchasing
·
fix: add noreferrer to target=_blank external links 118b48e →