Skip to content

Commit

Permalink
(fix) Fix label rendering bug in Contact details component (openmrs#1641
Browse files Browse the repository at this point in the history
)
  • Loading branch information
denniskigen authored Feb 7, 2024
1 parent e89b914 commit 9cf2032
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { ConfigurableLink, parseDate, useConfig } from '@openmrs/esm-framework';
import { useRelationships } from './relationships.resource';
import { usePatientContactAttributes } from '../hooks/usePatientAttributes';
import { usePatientListsForPatient } from '../hooks/usePatientListsForPatient';
import styles from './contact-details.scss';
import { type ConfigObject } from '../config-schema';
import styles from './contact-details.scss';

interface ContactDetailsProps {
address: Array<fhir.Address>;
Expand Down Expand Up @@ -120,7 +120,7 @@ const Contact: React.FC<{ telecom: Array<fhir.ContactPoint>; patientUuid: string

const contacts = useMemo(
() => [
...telecom?.map((contact) => [t(contact.system, contact.system), contact.value]),
...telecom?.map((contact) => [t(contact.system, contact.system), contact.value, contact.id]),
...contactAttributes?.map((contact) => [
t(contact.attributeType.display, contact.attributeType.display),
contact.value,
Expand All @@ -137,9 +137,10 @@ const Contact: React.FC<{ telecom: Array<fhir.ContactPoint>; patientUuid: string
) : (
<ul>
{contacts.length ? (
contacts.map(([label, value], index) => (
<li key={`${label}-${value}-${index}`}>
{label}: {value}
contacts.map(([label, value, id]) => (
<li key={id}>
{label ? `${label}: ` : ''}
{value}
</li>
))
) : (
Expand Down

0 comments on commit 9cf2032

Please sign in to comment.