From 6f1b66f9dcb28b898ef00866c9eea58d9398db9e Mon Sep 17 00:00:00 2001 From: Joel Jeremy Marquez Date: Mon, 29 Apr 2024 15:12:11 -0700 Subject: [PATCH] Append note tag filters --- .../src/components/accounts/Account.jsx | 17 ++++++++++++----- .../components/transactions/TransactionList.jsx | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/desktop-client/src/components/accounts/Account.jsx b/packages/desktop-client/src/components/accounts/Account.jsx index 75a22892af..8e592e7f2d 100644 --- a/packages/desktop-client/src/components/accounts/Account.jsx +++ b/packages/desktop-client/src/components/accounts/Account.jsx @@ -1304,7 +1304,7 @@ class AccountInternal extends PureComponent { } }; - applyFilters = async conditions => { + applyFilters = async (conditions, append = false) => { if (conditions.length > 0) { const customQueryFilters = conditions .filter(cond => !!cond.customName) @@ -1320,9 +1320,16 @@ class AccountInternal extends PureComponent { [conditionsOpKey]: [...queryFilters, ...customQueryFilters], }); - this.setState({ filterConditions: conditions }, () => { - this.updateQuery(this.currentQuery, true); - }); + this.setState( + prevState => ({ + filterConditions: append + ? [...prevState.filterConditions, ...conditions] + : conditions, + }), + () => { + this.updateQuery(this.currentQuery, true); + }, + ); } else { this.setState( { @@ -1652,7 +1659,7 @@ class AccountInternal extends PureComponent { this.setState({ isAdding: false }) } onCreatePayee={this.onCreatePayee} - onApplyFilters={conditions => this.applyFilters(conditions)} + onApplyFilters={this.applyFilters} /> diff --git a/packages/desktop-client/src/components/transactions/TransactionList.jsx b/packages/desktop-client/src/components/transactions/TransactionList.jsx index 7c0a2cf197..b23f2c05d8 100644 --- a/packages/desktop-client/src/components/transactions/TransactionList.jsx +++ b/packages/desktop-client/src/components/transactions/TransactionList.jsx @@ -171,7 +171,7 @@ export function TransactionList({ const filterConditions = [ { field: 'notes', op: 'contains', value: noteTag, type: 'string' }, ]; - onApplyFilters(filterConditions); + onApplyFilters(filterConditions, true); }); return (