Skip to content

Commit

Permalink
Append note tag filters
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Apr 29, 2024
1 parent eea961a commit 6f1b66f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions packages/desktop-client/src/components/accounts/Account.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(
{
Expand Down Expand Up @@ -1652,7 +1659,7 @@ class AccountInternal extends PureComponent {
this.setState({ isAdding: false })
}
onCreatePayee={this.onCreatePayee}
onApplyFilters={conditions => this.applyFilters(conditions)}
onApplyFilters={this.applyFilters}
/>
</View>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export function TransactionList({
const filterConditions = [
{ field: 'notes', op: 'contains', value: noteTag, type: 'string' },
];
onApplyFilters(filterConditions);
onApplyFilters(filterConditions, true);
});

return (
Expand Down

0 comments on commit 6f1b66f

Please sign in to comment.