A local-first personal finance app
[AI] Keep the search applied after toggling reconciled transactions (#9360)
Martin Boucher38ba95dcdc2c
diff --git a/packages/desktop-client/e2e/accounts.test.ts b/packages/desktop-client/e2e/accounts.test.tsindex 784d12a814..eec5673971 100644--- a/packages/desktop-client/e2e/accounts.test.ts+++ b/packages/desktop-client/e2e/accounts.test.ts@@ -233,6 +233,74 @@ test.describe('Accounts', () => {await expect(accountPage.selectButton).toHaveText('2 transactions');});+ test('keeps the search applied after toggling reconciled transactions', async () => {+ accountPage = await navigation.createAccount({+ name: 'Search Toggle',+ offBudget: false,+ balance: 0,+ });+ await accountPage.waitFor();++ for (const note of ['search-match', 'search-other']) {+ await accountPage.createSingleTransaction({+ payee: '',+ notes: note,+ debit: '10.00',+ });+ }++ await page.getByPlaceholder('Search').fill('search-match');+ await expect(+ accountPage.transactionTableRow.filter({ hasText: 'search-other' }),+ ).not.toBeVisible();++ await accountPage.accountMenuButton.click();+ await page+ .getByRole('button', { name: /(Hide|Show) reconciled transactions/ })+ .click();++ await expect(+ accountPage.transactionTableRow.filter({ hasText: 'search-match' }),+ ).toBeVisible();+ await expect(+ accountPage.transactionTableRow.filter({ hasText: 'search-other' }),+ ).not.toBeVisible();+ });++ test('keeps the filter applied after toggling reconciled transactions', async () => {+ accountPage = await navigation.createAccount({+ name: 'Filter Toggle',+ offBudget: false,+ balance: 0,+ });+ await accountPage.waitFor();++ for (const note of ['filter-match', 'filter-other']) {+ await accountPage.createSingleTransaction({+ payee: '',+ notes: note,+ debit: '10.00',+ });+ }++ await accountPage.filterByNote('filter-match');+ await expect(+ accountPage.transactionTableRow.filter({ hasText: 'filter-other' }),+ ).not.toBeVisible();++ await accountPage.accountMenuButton.click();+ await page+ .getByRole('button', { name: /(Hide|Show) reconciled transactions/ })+ .click();++ await expect(+ accountPage.transactionTableRow.filter({ hasText: 'filter-match' }),+ ).toBeVisible();+ await expect(+ accountPage.transactionTableRow.filter({ hasText: 'filter-other' }),+ ).not.toBeVisible();+ });+test('opens the other side of a transfer from its arrow', async () => {accountPage = await navigation.goToAccountPage('Bank of America');await accountPage.createSingleTransaction({diff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsxindex 51e4879b48..b3e4382349 100644--- a/packages/desktop-client/src/components/accounts/Account.tsx+++ b/packages/desktop-client/src/components/accounts/Account.tsx@@ -646,7 +646,9 @@ class AccountInternal extends PureComponent<this.setState({ search: value }, this.onSearchDone);};- onSearchDone = debounce(() => {+ onSearchDone = debounce(() => this.applySearch(), 150);++ applySearch = () => {if (this.state.search === '') {this.updateQuery(this.currentQuery,@@ -662,7 +664,7 @@ class AccountInternal extends PureComponent<true,);}- }, 150);+ };onSync = async () => {const accountId = this.props.accountId;@@ -959,19 +961,12 @@ class AccountInternal extends PureComponent<});break;}- case 'toggle-reconciled':- if (this.state.showReconciled) {- this.props.setShowReconciled(false);- this.setState({ showReconciled: false }, () =>- this.fetchTransactions(this.state.filterConditions),- );- } else {- this.props.setShowReconciled(true);- this.setState({ showReconciled: true }, () =>- this.fetchTransactions(this.state.filterConditions),- );- }+ case 'toggle-reconciled': {+ const showReconciled = !this.state.showReconciled;+ this.props.setShowReconciled(showReconciled);+ this.setState({ showReconciled }, this.applySearch);break;+ }case 'toggle-net-worth-chart':if (this.props.showNetWorthChart) {this.props.setShowNetWorthChart(false);diff --git a/upcoming-release-notes/keep-search-after-reconciled-toggle.md b/upcoming-release-notes/keep-search-after-reconciled-toggle.mdnew file mode 100644index 0000000000..f2c26f98b9--- /dev/null+++ b/upcoming-release-notes/keep-search-after-reconciled-toggle.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [boutchitos]+---++Keep the account search applied after showing or hiding reconciled transactions