diff --git a/src/components/fields/SubTable/utils.ts b/src/components/fields/SubTable/utils.ts index 6f6c7746..79ae5dc1 100644 --- a/src/components/fields/SubTable/utils.ts +++ b/src/components/fields/SubTable/utils.ts @@ -2,6 +2,7 @@ import { useLocation } from "react-router-dom"; import { ROUTES } from "@src/constants/routes"; import { ColumnConfig, TableRow, TableRowRef } from "@src/types/table"; +import get from "lodash-es/get"; export const useSubTableData = ( column: ColumnConfig, @@ -9,8 +10,8 @@ export const useSubTableData = ( _rowy_ref: TableRowRef ) => { const label = (column.config?.parentLabel ?? []).reduce((acc, curr) => { - if (acc !== "") return `${acc} - ${row[curr]}`; - else return row[curr]; + if (acc !== "") return `${acc} - ${get(row, curr)}`; + else return get(row, curr); }, ""); const documentCount: string = row[column.fieldName]?.count ?? "";