From 2f9628aa956ad0fa0f0f39fe2742533e3d6406b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 16 Oct 2026 08:32:49 +0200 Subject: [PATCH] fix(links): name a related dose by its vaccine, not its catalogue slug --- .../links/__tests__/related-records.test.tsx | 29 +++++++++++++++++++ src/components/links/related-records.tsx | 7 +++++ 2 files changed, 36 insertions(+) diff --git a/src/components/links/__tests__/related-records.test.tsx b/src/components/links/__tests__/related-records.test.tsx index 5639e5ba9..7ba101d7a 100644 --- a/src/components/links/__tests__/related-records.test.tsx +++ b/src/components/links/__tests__/related-records.test.tsx @@ -53,6 +53,35 @@ describe("", () => { expect(html).not.toContain(">SPECIALIST<"); }); + it("names a dose labelled by its catalogue slug from the reader's bundle", () => { + const html = render( + , + ); + expect(html).toContain(">Tetanus<"); + expect(html).not.toContain(">tetanus<"); + // A written name that is no catalogue slug stays as written. + expect(html).toContain("as-written-on-the-card"); + }); + it("says how a derived relation runs", () => { const html = render(); expect(html).toContain("through the efficacy target"); diff --git a/src/components/links/related-records.tsx b/src/components/links/related-records.tsx index 68ce45373..908003b3a 100644 --- a/src/components/links/related-records.tsx +++ b/src/components/links/related-records.tsx @@ -111,6 +111,13 @@ function rowLabel(t: Translate, row: RelatedLink): string { ) { return encounterKindText(t, row.label as EncounterKind); } + // A dose without a written name arrives as its catalogue slug ("tetanus"), + // named here from the reader's bundle the way the dose picker names it. + if (row.kind === "vaccination" && /^[a-z0-9_-]+$/.test(row.label)) { + const key = `vaccinations.catalog.${row.label}`; + const name = t(key); + if (name !== key) return name; + } return row.label; }