fix(stammbaum): drop inferred relationships that are already direct

A spouse listed as a direct PersonRelationship was also being
emitted as an inferred SPOUSE chip below, so the same person
appeared twice in the Beziehungen card.

Filter the inferred list against the IDs already shown as direct
edges before slicing the top 5. Added a component test that
renders red without the filter and green with it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-27 19:47:49 +02:00
committed by marcel
parent a7b1dcb5e1
commit 48a704f002
2 changed files with 60 additions and 1 deletions

View File

@@ -14,7 +14,10 @@ interface Props {
let { personId, relationships, inferredRelationships }: Props = $props();
const topDerived = $derived(inferredRelationships.slice(0, 5));
const directOtherIds = $derived(new Set(relationships.map((rel) => otherId(rel))));
const topDerived = $derived(
inferredRelationships.filter((d) => !directOtherIds.has(d.person.id)).slice(0, 5)
);
function chipLabel(rel: RelationshipDTO): string {
const viewpointIsSubject = rel.personId === personId;