A local-first personal finance app
:bug: fix the running balance on mobile for large accounts (#6241)
youngcwba00a25c8592
diff --git a/packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsx b/packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsxindex a324a62253..9c2fc559e9 100644--- a/packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsx+++ b/packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsx@@ -18,8 +18,12 @@ import { SchedulesProvider } from '@desktop-client/hooks/useCachedSchedules';import { useDateFormat } from '@desktop-client/hooks/useDateFormat';import { useNavigate } from '@desktop-client/hooks/useNavigate';import { getSchedulesQuery } from '@desktop-client/hooks/useSchedules';+import { useSheetValue } from '@desktop-client/hooks/useSheetValue';import { useSyncedPref } from '@desktop-client/hooks/useSyncedPref';-import { useTransactions } from '@desktop-client/hooks/useTransactions';+import {+ useTransactions,+ calculateRunningBalancesTopDown,+} from '@desktop-client/hooks/useTransactions';import { useTransactionsSearch } from '@desktop-client/hooks/useTransactionsSearch';import { collapseModals, pushModal } from '@desktop-client/modals/modalsSlice';import * as queries from '@desktop-client/queries';@@ -73,6 +77,15 @@ function TransactionListWithPreviews({const shouldCalculateRunningBalances =showRunningBalances === 'true' && !!account?.id && !isSearching;+ const accountBalanceValue = useSheetValue<+ 'account',+ 'balance' | 'accounts-balance'+ >(+ account?.id+ ? bindings.accountBalance(account?.id)+ : bindings.allAccountBalance(),+ );+const {transactions,runningBalances,@@ -83,7 +96,10 @@ function TransactionListWithPreviews({} = useTransactions({query: transactionsQuery,options: {- calculateRunningBalances: shouldCalculateRunningBalances,+ calculateRunningBalances: shouldCalculateRunningBalances+ ? calculateRunningBalancesTopDown+ : shouldCalculateRunningBalances,+ startingBalance: accountBalanceValue || 0,},});diff --git a/upcoming-release-notes/6241.md b/upcoming-release-notes/6241.mdnew file mode 100644index 0000000000..d3a2ef6bdf--- /dev/null+++ b/upcoming-release-notes/6241.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [youngcw]+---++Fix mobile running balance on accounts with many transactions