diff --git a/services/ui-src/src/components/pages/Dashboard/DashboardTable.tsx b/services/ui-src/src/components/pages/Dashboard/DashboardTable.tsx index 33db83a01..bc3663cf5 100644 --- a/services/ui-src/src/components/pages/Dashboard/DashboardTable.tsx +++ b/services/ui-src/src/components/pages/Dashboard/DashboardTable.tsx @@ -166,17 +166,23 @@ export const getStatus = ( } return status; }; + const tableBody = (body: TableContentShape, isAdmin: boolean) => { - var tableContent = body; - if (!isAdmin) { - tableContent.headRow = tableContent.headRow!.filter((e) => e !== "#"); - return tableContent; - } else { - tableContent.headRow = tableContent.headRow!.filter( - (e) => e !== "Due date" && e !== "Target populations" + const tableContent = { ...body }; + + if (!tableContent.headRow) { + return body; + } + + if (isAdmin) { + tableContent.headRow = tableContent.headRow.filter( + (e) => !["Due date", "Target populations"].includes(e) ); + } else { + tableContent.headRow = tableContent.headRow.filter((e) => e !== "#"); } - return body; + + return tableContent; }; const EditReportButton = ({