← back to Homesonspec
Design review fix: dedupe home detail Data-provenance table to one row per field (newest) — kills the ~8x per-snapshot row bloat the visual review caught
823198162bc8c2028bf032a6d301792895a15814 · 2026-07-22 22:14:11 -0700 · Steve
Files touched
M apps/web/src/app/homes/[id]/page.tsx
Diff
commit 823198162bc8c2028bf032a6d301792895a15814
Author: Steve <steve@designerwallcoverings.com>
Date: Wed Jul 22 22:14:11 2026 -0700
Design review fix: dedupe home detail Data-provenance table to one row per field (newest) — kills the ~8x per-snapshot row bloat the visual review caught
---
apps/web/src/app/homes/[id]/page.tsx | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/apps/web/src/app/homes/[id]/page.tsx b/apps/web/src/app/homes/[id]/page.tsx
index 476cdb2..c215a94 100644
--- a/apps/web/src/app/homes/[id]/page.tsx
+++ b/apps/web/src/app/homes/[id]/page.tsx
@@ -59,6 +59,17 @@ export default async function HomeDetailPage({ params }: { params: Promise<{ id:
// Kill-switch for third-party builder photography (media-rights gate).
const showImages = process.env.BUILDER_IMAGES_ENABLED !== "0";
+ // Dedupe evidence to one row per field (newest retrieval). Re-crawls produce a
+ // fresh snapshot each time (dynamic source content), so raw evidence accumulates
+ // ~1 row per field per crawl — show only the latest so the table stays readable.
+ const latestEvidence = Object.values(
+ evidence.reduce<Record<string, (typeof evidence)[number]>>((acc, row) => {
+ const cur = acc[row.field];
+ if (!cur || row.retrievedAt > cur.retrievedAt) acc[row.field] = row;
+ return acc;
+ }, {}),
+ ).sort((a, b) => a.field.localeCompare(b.field));
+
const facts: [string, string][] = [
["Price", fmtPrice(home.price === null ? null : Number(home.price))],
["Status", STATUS_LABELS[home.constructionStatus] ?? home.constructionStatus],
@@ -206,7 +217,7 @@ export default async function HomeDetailPage({ params }: { params: Promise<{ id:
</tr>
</thead>
<tbody>
- {evidence.map((row) => (
+ {latestEvidence.map((row) => (
<tr key={row.id} className="border-b border-neutral-100">
<td className="py-1.5 pr-3 font-medium">{row.field}</td>
<td className="py-1.5 pr-3">{row.evidenceText ?? <em className="text-neutral-400">not stated by source</em>}</td>
@@ -214,7 +225,7 @@ export default async function HomeDetailPage({ params }: { params: Promise<{ id:
<td className="py-1.5">{(row.confidence * 100).toFixed(0)}%</td>
</tr>
))}
- {evidence.length === 0 && (
+ {latestEvidence.length === 0 && (
<tr><td colSpan={4} className="py-2 text-neutral-400">No field-level evidence recorded.</td></tr>
)}
</tbody>
← 2968a92 Builder-image kill-switch: BUILDER_IMAGES_ENABLED env gates
·
back to Homesonspec
·
Fix broken search: when a query doesn't resolve to a locatio ef19ec0 →