Skip to content

A local-first personal finance app

:bug: fix schedule preview running balance of split schedules (#4881)

youngcw916a27a89a83
diff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsx
index dc0a9350bd..36d8eb1313 100644
--- a/packages/desktop-client/src/components/accounts/Account.tsx
+++ b/packages/desktop-client/src/components/accounts/Account.tsx
@@ -159,12 +159,18 @@ function AllTransactions({
const previewBalances = [...previewTransactions]
.reverse()
.map(previewTransaction => {
- return {
- // TODO: fix me
- // eslint-disable-next-line react-hooks/exhaustive-deps
- balance: (runningBalance += previewTransaction.amount),
- id: previewTransaction.id,
- };
+ if (!previewTransaction.is_child) {
+ return {
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ balance: (runningBalance += previewTransaction.amount),
+ id: previewTransaction.id,
+ };
+ } else {
+ return {
+ balance: 0,
+ id: previewTransaction.id,
+ };
+ }
});
return groupById(previewBalances);
}, [showBalances, previewTransactions, runningBalance]);
diff --git a/upcoming-release-notes/4881.md b/upcoming-release-notes/4881.md
new file mode 100644
index 0000000000..ab6a857398
--- /dev/null
+++ b/upcoming-release-notes/4881.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [youngcw]
+---
+
+Fix running balance on split schedule previews