[PR #6434] [CLOSED] [WIP] Fix mobile running balance toggle issue (#6368) #25131

Closed
opened 2026-04-16 18:24:43 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/6434
Author: @mustafamagdy
Created: 12/17/2025
Status: Closed

Base: masterHead: fix-mobile-running-balance


📝 Commits (1)

  • f72df23 Fix mobile running balance toggle issue

📊 Changes

1 file changed (+122 additions, -1788 deletions)

View changed files

📝 packages/desktop-client/src/components/accounts/Account.tsx (+122 -1788)

📄 Description

Summary

Fixes the issue where enabling "Show running balance" on mobile would immediately clear the transactions list, making it appear as if the feature was broken. Users had to navigate away and back to see the transactions with running balances.

Issue Description

  • Problem: When clicking "Show running balance" in the mobile account menu, all transactions would disappear immediately
  • User Experience: Feature appeared broken, requiring navigation away and back to work
  • Root Cause: The toggle logic was clearing all transactions and resetting filters before refetching data

Root Cause Analysis

The issue was in the toggle-balance case of the onMenuSelect method in Account.tsx:

// BEFORE (problematic code)
this.setState(
  {
    transactions: [],        // ❌ Clears all visible transactions
    transactionCount: 0,     // ❌ Resets the count
    filterConditions: [],    // ❌ Clears any active filters
    search: '',              // ❌ Clears any search
    sort: null,              // ❌ Clears any sorting
    showBalances: true,
  },
  () => {
    this.fetchTransactions(); // ❌ Fetches but no loading state shown
  },
);

Solution

Simplified the toggle logic to preserve existing transactions and just recalculate balances:

// AFTER (fixed code)
this.setState({ showBalances: true }, () => {
  // Force a recalculation of running balances on existing transactions
  this.refetchTransactions();
});

Changes Made

  • File: packages/desktop-client/src/components/accounts/Account.tsx
  • Method: onMenuSelect (lines 241-254)
  • Key Changes:
    • Removed code that cleared transactions, filters, search, and sort
    • Simplified to just set showBalances: true and call refetchTransactions()
    • Preserves existing transaction data while recalculating balances

Testing

  1. Open an account on mobile view
  2. Click the account menu (three dots)
  3. Select "Show running balance"
  4. Transactions remain visible
  5. Running balances appear immediately
  6. Toggle back off works correctly

Impact

  • User Experience: No more empty screen when enabling running balance
  • Performance: Avoids unnecessary data refetching and state resets
  • Consistency: Behavior now matches the mobile component approach
  • Backward Compatibility: No breaking changes to existing functionality

Fixes #6368


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/6434 **Author:** [@mustafamagdy](https://github.com/mustafamagdy) **Created:** 12/17/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix-mobile-running-balance` --- ### 📝 Commits (1) - [`f72df23`](https://github.com/actualbudget/actual/commit/f72df23639584e2be8ab452b445ca6364ba08bcb) Fix mobile running balance toggle issue ### 📊 Changes **1 file changed** (+122 additions, -1788 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/accounts/Account.tsx` (+122 -1788) </details> ### 📄 Description ## Summary Fixes the issue where enabling "Show running balance" on mobile would immediately clear the transactions list, making it appear as if the feature was broken. Users had to navigate away and back to see the transactions with running balances. ## Issue Description - **Problem**: When clicking "Show running balance" in the mobile account menu, all transactions would disappear immediately - **User Experience**: Feature appeared broken, requiring navigation away and back to work - **Root Cause**: The toggle logic was clearing all transactions and resetting filters before refetching data ## Root Cause Analysis The issue was in the `toggle-balance` case of the `onMenuSelect` method in `Account.tsx`: ```javascript // BEFORE (problematic code) this.setState( { transactions: [], // ❌ Clears all visible transactions transactionCount: 0, // ❌ Resets the count filterConditions: [], // ❌ Clears any active filters search: '', // ❌ Clears any search sort: null, // ❌ Clears any sorting showBalances: true, }, () => { this.fetchTransactions(); // ❌ Fetches but no loading state shown }, ); ``` ## Solution Simplified the toggle logic to preserve existing transactions and just recalculate balances: ```javascript // AFTER (fixed code) this.setState({ showBalances: true }, () => { // Force a recalculation of running balances on existing transactions this.refetchTransactions(); }); ``` ## Changes Made - **File**: `packages/desktop-client/src/components/accounts/Account.tsx` - **Method**: `onMenuSelect` (lines 241-254) - **Key Changes**: - Removed code that cleared transactions, filters, search, and sort - Simplified to just set `showBalances: true` and call `refetchTransactions()` - Preserves existing transaction data while recalculating balances ## Testing 1. Open an account on mobile view 2. Click the account menu (three dots) 3. Select "Show running balance" 4. ✅ Transactions remain visible 5. ✅ Running balances appear immediately 6. ✅ Toggle back off works correctly ## Impact - ✅ **User Experience**: No more empty screen when enabling running balance - ✅ **Performance**: Avoids unnecessary data refetching and state resets - ✅ **Consistency**: Behavior now matches the mobile component approach - ✅ **Backward Compatibility**: No breaking changes to existing functionality Fixes #6368 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 18:24:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#25131