From d243142705d63d863765c037f68bd531f8eb2634 Mon Sep 17 00:00:00 2001 From: Celes Renata Date: Fri, 17 Apr 2026 07:18:41 +0000 Subject: [PATCH] fix: trend evidence shows document titles instead of truncated UUIDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - EvidenceRef component now fetches document details via useDocument() hook and displays the title instead of 'doc:43156423…' - TanStack Query deduplicates and caches lookups for repeated doc IDs - Pattern IDs still render as before (e.g. 'pattern META other (1d)') - Override Trade button changed from brand-600 to red-600 --- frontend/src/pages/Trading.tsx | 2 +- frontend/src/pages/Trends.tsx | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/frontend/src/pages/Trading.tsx b/frontend/src/pages/Trading.tsx index 500d536..bf47c6d 100644 --- a/frontend/src/pages/Trading.tsx +++ b/frontend/src/pages/Trading.tsx @@ -82,7 +82,7 @@ export function TradingPage() { Override Trade diff --git a/frontend/src/pages/Trends.tsx b/frontend/src/pages/Trends.tsx index b6a46f7..2fead84 100644 --- a/frontend/src/pages/Trends.tsx +++ b/frontend/src/pages/Trends.tsx @@ -1,6 +1,6 @@ import { useState } from 'react'; import { useNavigate, Link } from '@tanstack/react-router'; -import { useTrends } from '../api/hooks'; +import { useTrends, useDocument } from '../api/hooks'; import { TrendArrow, ConfidenceBar, LoadingSpinner, TickerFilter, Card } from '../components/ui'; import type { TrendSummary } from '../api/hooks'; @@ -120,6 +120,8 @@ const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/ function EvidenceRef({ id, direction }: { id: string; direction: 'supporting' | 'opposing' }) { const sign = direction === 'supporting' ? '+' : '−'; const color = direction === 'supporting' ? 'text-green-400' : 'text-red-400'; + const isUuid = UUID_RE.test(id); + const { data: doc } = useDocument(isUuid ? id : undefined); // Pattern IDs like "pattern:META:other:1d" are already readable if (id.startsWith('pattern:')) { @@ -134,18 +136,19 @@ function EvidenceRef({ id, direction }: { id: string; direction: 'supporting' | ); } - // UUIDs — show as short clickable links to the document - if (UUID_RE.test(id)) { + // UUIDs — show document title if available, otherwise short ID + if (isUuid) { + const label = doc?.title ?? `doc:${id.slice(0, 8)}…`; return (
{sign}{' '} e.stopPropagation()} > - doc:{id.slice(0, 8)}… + {label}
);