diff --git a/user-interface/src/case-detail/panels/CaseDetailAuditHistory.tsx b/user-interface/src/case-detail/panels/CaseDetailAuditHistory.tsx index 0d2938df2..06bddc9bd 100644 --- a/user-interface/src/case-detail/panels/CaseDetailAuditHistory.tsx +++ b/user-interface/src/case-detail/panels/CaseDetailAuditHistory.tsx @@ -11,6 +11,7 @@ import { } from '@common/cams/history'; import { useEffect, useState } from 'react'; import Api2 from '@/lib/models/api2'; +import { CaseAssignment } from '@common/cams/assignments'; export interface CaseDetailAuditHistoryProps { caseId: string; @@ -42,20 +43,26 @@ export default function CaseDetailAuditHistory(props: CaseDetailAuditHistoryProp Staff - {history.before.length === 0 && <>(none)} - {history.before - .map((assignment) => { - return assignment.name; - }) - .join(', ')} + {assignmentHistoryHasValue(history.before) ? ( + history.before + .map((assignment) => { + return assignment.name; + }) + .join(', ') + ) : ( + <>(none) + )} - {history.after.length === 0 && <>(none)} - {history.after - .map((assignment) => { - return assignment.name; - }) - .join(', ')} + {assignmentHistoryHasValue(history.after) ? ( + history.after + .map((assignment) => { + return assignment.name; + }) + .join(', ') + ) : ( + <>(none) + )} {history.updatedBy && <>{history.updatedBy.name}} @@ -90,6 +97,13 @@ export default function CaseDetailAuditHistory(props: CaseDetailAuditHistoryProp ); } + function assignmentHistoryHasValue(assignmentHistory: CaseAssignment[] | null): boolean { + let noValue = true; + if (assignmentHistory === null || assignmentHistory.length === 0) { + noValue = false; + } + return noValue; + } function renderCaseHistory() { return caseHistory.map((history, idx: number) => {