diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx index ca7f71188d9de2663a34fc5ef4723f7b0237a2b6..4d380951f1d41292e342723a8ac278113f4d186a 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx @@ -50,10 +50,9 @@ export function ReportTable({ }); const renderItem = useCallback( - ({ item, groupByItem, mode, style, key, monthsCount }) => { + ({ item, groupByItem, mode, style, monthsCount }) => { return ( <ReportTableRow - key={key} item={item} balanceTypeOp={balanceTypeOp} groupByItem={groupByItem} diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableList.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableList.tsx index 95b377995a3f52e77883bb038ad6d7da8fa09cf1..ca8c7621db00fa5e4e746ed19b67f00a450b8ffb 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableList.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableList.tsx @@ -27,22 +27,21 @@ export function ReportTableList({ const groupByItem = ['Month', 'Year'].includes(groupBy) ? 'date' : 'name'; type RenderRowProps = { - key: string; index: number; parent_index?: number; style?: CSSProperties; }; - function RenderRow({ index, parent_index, style, key }: RenderRowProps) { - const item = parent_index - ? data[parent_index].categories[index] - : data[index]; + function RenderRow({ index, parent_index, style }: RenderRowProps) { + const item = + parent_index === undefined + ? data[index] + : data[parent_index].categories[index]; return renderItem({ item, groupByItem, mode, style, - key, monthsCount, }); } @@ -55,7 +54,6 @@ export function ReportTableList({ {data ? ( <> <RenderRow - key={item.id} index={index} style={ item.categories && { diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx index adf237c47837541aa33db364d4b09d2589aaabac..b0adffaa2dd885ffed52a961029c770c1a116123 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx @@ -31,6 +31,7 @@ export const ReportTableRow = memo( const average = amountToInteger(item[balanceTypeOp]) / monthsCount; return ( <Row + key={item.id} collapsed={true} style={{ color: theme.tableText, diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx index c98527cd0e8cfede2284f371d200e3417c54c037..c149e5d6ccab63db9657665b0654cd8327aa3020 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx @@ -91,8 +91,9 @@ export function ReportTableTotals({ key={amountToCurrency(item[balanceTypeOp])} value={amountToCurrency(item[balanceTypeOp])} title={ - Math.abs(item[balanceTypeOp]) > 100000 && - amountToCurrency(item[balanceTypeOp]) + Math.abs(item[balanceTypeOp]) > 100000 + ? amountToCurrency(item[balanceTypeOp]) + : undefined } width="flex" privacyFilter @@ -108,8 +109,9 @@ export function ReportTableTotals({ }} value={amountToCurrency(data.totalAssets)} title={ - Math.abs(data.totalAssets) > 100000 && - amountToCurrency(data.totalAssets) + Math.abs(data.totalAssets) > 100000 + ? amountToCurrency(data.totalAssets) + : undefined } width="flex" privacyFilter @@ -121,8 +123,9 @@ export function ReportTableTotals({ }} value={amountToCurrency(data.totalDebts)} title={ - Math.abs(data.totalDebts) > 100000 && - amountToCurrency(data.totalDebts) + Math.abs(data.totalDebts) > 100000 + ? amountToCurrency(data.totalDebts) + : undefined } width="flex" privacyFilter @@ -136,8 +139,9 @@ export function ReportTableTotals({ }} value={amountToCurrency(data[balanceTypeOp])} title={ - Math.abs(data[balanceTypeOp]) > 100000 && - amountToCurrency(data[balanceTypeOp]) + Math.abs(data[balanceTypeOp]) > 100000 + ? amountToCurrency(data[balanceTypeOp]) + : undefined } width="flex" privacyFilter @@ -149,8 +153,9 @@ export function ReportTableTotals({ }} value={integerToCurrency(Math.round(average))} title={ - Math.abs(Math.round(average / 100)) > 100000 && - integerToCurrency(Math.round(average)) + Math.abs(Math.round(average / 100)) > 100000 + ? integerToCurrency(Math.round(average)) + : undefined } width="flex" privacyFilter diff --git a/upcoming-release-notes/2249.md b/upcoming-release-notes/2249.md new file mode 100644 index 0000000000000000000000000000000000000000..b5607975078ef45c07de661273d6db687c020497 --- /dev/null +++ b/upcoming-release-notes/2249.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [carkom] +--- + +Fixing a bug where custom reports table graph crashes due to a type mismatch error.