fix(web): dedupe rule-result evidence chips by eventId

Multiple matched conditions often extract different fields from the same
event (e.g. enrollment_failed + enrollment_failed_reason), which rendered
duplicate identically-labeled chips all jumping to the same timeline event.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Oliver Kieselbach
2026-07-10 12:59:22 +02:00
parent 5b7a602574
commit f1d00fec0f
2 changed files with 10 additions and 0 deletions
@@ -794,10 +794,15 @@ export default function DiagnosisPage() {
function EvidenceEventLinks({ matchedConditions, sessionId }: { matchedConditions: Record<string, any>; sessionId: string }) {
const eventLinks: { signal: string; eventId: string; eventType?: string }[] = [];
const seenEventIds = new Set<string>();
for (const [signal, evidence] of Object.entries(matchedConditions)) {
if (signal.startsWith("factor_")) continue;
if (evidence && typeof evidence === "object" && evidence.eventId) {
// Multiple matched conditions can extract different fields from the
// same event — one chip per distinct event, not per condition.
if (seenEventIds.has(evidence.eventId)) continue;
seenEventIds.add(evidence.eventId);
eventLinks.push({ signal, eventId: evidence.eventId, eventType: evidence.eventType });
}
}
@@ -306,10 +306,15 @@ function scrollToEvent(eventId: string) {
function EvidenceEventLinks({ matchedConditions }: { matchedConditions: Record<string, any> }) {
const eventLinks: { signal: string; eventId: string; eventType?: string }[] = [];
const seenEventIds = new Set<string>();
for (const [signal, evidence] of Object.entries(matchedConditions)) {
if (signal.startsWith("factor_")) continue;
if (evidence && typeof evidence === "object" && evidence.eventId) {
// Multiple matched conditions can extract different fields from the
// same event — one chip per distinct event, not per condition.
if (seenEventIds.has(evidence.eventId)) continue;
seenEventIds.add(evidence.eventId);
eventLinks.push({ signal, eventId: evidence.eventId, eventType: evidence.eventType });
}
}