[object Object]

← back to Wallco Ai

extend hex-consistent naming to grid (/api/designs) + search so names match the PDP

60d7b6ff7e394b3083d73c5a99152f935b99a309 · 2026-06-01 17:05:18 -0700 · Steve Abrams

Grid and search were still serving raw snapshot titles while the PDP served the
hex-derived name, which would show 'Sapphire Studio' in the grid and 'Verdigris
Studio' on the detail page. Apply the same derivation to shallow copies (grid)
and the search result object — never mutating the shared in-memory DESIGNS.

Files touched

Diff

commit 60d7b6ff7e394b3083d73c5a99152f935b99a309
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Jun 1 17:05:18 2026 -0700

    extend hex-consistent naming to grid (/api/designs) + search so names match the PDP
    
    Grid and search were still serving raw snapshot titles while the PDP served the
    hex-derived name, which would show 'Sapphire Studio' in the grid and 'Verdigris
    Studio' on the detail page. Apply the same derivation to shallow copies (grid)
    and the search result object — never mutating the shared in-memory DESIGNS.
---
 server.js | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/server.js b/server.js
index 7bbadde..cec8603 100644
--- a/server.js
+++ b/server.js
@@ -585,7 +585,9 @@ app.get('/api/designs/search', (req, res) => {
       if (handle.includes(t))   score += 1;
     }
     if (score > 0) {
-      out.push({
+      // match on the raw title above; display the hex-consistent name (matches
+      // the grid + PDP). New object, not the shared DESIGNS row.
+      out.push(applyHexConsistentNaming({
         id: d.id,
         title: d.title,
         category: d.category,
@@ -596,7 +598,7 @@ app.get('/api/designs/search', (req, res) => {
         score,
         saturation: d.saturation || 0,
         url: `/design/${d.id}`,
-      });
+      }));
     }
   }
   // Did-you-mean: if no hits, search the vocabulary for near-matches to each term.
@@ -20737,7 +20739,11 @@ app.get('/api/designs', (req, res) => {
 
   const total = filtered.length;
   const pages = Math.ceil(total / PER);
-  const items = filtered.slice((page-1)*PER, page*PER);
+  // Shallow-copy each row and re-derive its color word from dominant_hex so the
+  // grid name matches the PDP (which does the same in /api/design/:id). Copies,
+  // not the shared DESIGNS objects — never mutate the in-memory catalog.
+  const items = filtered.slice((page-1)*PER, page*PER)
+    .map(d => applyHexConsistentNaming(Object.assign({}, d)));
   res.json({ ok: true, total, page, pages, items });
 });
 

← 50731bb generator: drop dead refresh-orders endpoint (fetch_recent_o  ·  back to Wallco Ai  ·  studio/search: fix dead pattern thumbnails (generator + stud 271f231 →