← back to Interiordesignershowroom
fix(render): match bigint product ids type-safe — /api/render was silently ignoring explicit product_ids (string p.id === number id never matched), rendering a generic room; also fixes /build explicit-piece selection
713ee0d87589eaaf324b84150c6886d8ee2d63f2 · 2026-08-03 07:32:34 -0700 · steve
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit 713ee0d87589eaaf324b84150c6886d8ee2d63f2
Author: steve <steve@designerwallcoverings.com>
Date: Mon Aug 3 07:32:34 2026 -0700
fix(render): match bigint product ids type-safe — /api/render was silently ignoring explicit product_ids (string p.id === number id never matched), rendering a generic room; also fixes /build explicit-piece selection
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
server.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/server.js b/server.js
index 399ae78..4a61b3d 100644
--- a/server.js
+++ b/server.js
@@ -343,7 +343,9 @@ app.post('/api/render', async (req, res) => {
let products = [];
if (ids.length) {
const r = await db.query('SELECT id,title,price,sale_price,image_url,advertiser FROM products WHERE id = ANY($1)', [ids]);
- products = ids.map((id) => r.rows.find((p) => p.id === id)).filter(Boolean);
+ // products.id is bigint → node-pg returns it as a STRING, so compare type-safe
+ // (a strict `p.id === id` against the numeric id silently matched nothing).
+ products = ids.map((id) => r.rows.find((p) => String(p.id) === String(id))).filter(Boolean);
} else {
// "generate from a vibe alone": back-fill real matching pieces so the room is
// populated with shoppable products (and shows their thumbs), loosening filters
← 96f59a1 ingest: partner-scoped CJ sweeps (partnerIds) + TWOPAGES pro
·
back to Interiordesignershowroom
·
feat: shop-time Mood Board — collect pieces while shopping, e5ef1c4 →