[object Object]

← back to Wallco Ai

/admin/reload-designs: also bump by-color cache version + clear entries (auto-invalidate stale palette results on catalog reload)

e884616fb2bf7b967a976af8aab126464d1f3e5b · 2026-05-13 07:13:59 -0700 · SteveStudio2

Files touched

Diff

commit e884616fb2bf7b967a976af8aab126464d1f3e5b
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date:   Wed May 13 07:13:59 2026 -0700

    /admin/reload-designs: also bump by-color cache version + clear entries (auto-invalidate stale palette results on catalog reload)
---
 server.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/server.js b/server.js
index 7ef1f29..8b0e66f 100644
--- a/server.js
+++ b/server.js
@@ -709,7 +709,11 @@ app.post('/admin/reload-designs', (req, res) => {
   if (!isAdmin(req)) return res.status(404).type('html').send('<h1>404</h1>');
   const before = DESIGNS.length;
   loadDesigns();
-  res.json({ ok: true, before, after: DESIGNS.length, catalog_last_modified: CATALOG_LAST_MODIFIED });
+  // Bump the by-color cache version + clear in-memory entries so stale palette/ΔE results
+  // can't outlive the new catalog state. ETags rebuild against the new CATALOG_LAST_MODIFIED.
+  _byColorCacheVer++;
+  _byColorCache.clear();
+  res.json({ ok: true, before, after: DESIGNS.length, catalog_last_modified: CATALOG_LAST_MODIFIED, by_color_cache_ver: _byColorCacheVer });
 });
 
 // ── TRADE LOGIN (separate from admin layer) — magic-link, no passwords.

← c3467a1 by-color: emit ETag on every response + 304 short-circuit on  ·  back to Wallco Ai  ·  drunk-animals: end-to-end smoke test, 19/19 passing 0ec07a8 →