Append note tag filters

This commit is contained in:
Joel Jeremy Marquez
2024-04-29 15:12:11 -07:00
parent eea961a20d
commit 6f1b66f9dc
2 changed files with 13 additions and 6 deletions

View File

@@ -1304,7 +1304,7 @@ class AccountInternal extends PureComponent {
} }
}; };
applyFilters = async conditions => { applyFilters = async (conditions, append = false) => {
if (conditions.length > 0) { if (conditions.length > 0) {
const customQueryFilters = conditions const customQueryFilters = conditions
.filter(cond => !!cond.customName) .filter(cond => !!cond.customName)
@@ -1320,9 +1320,16 @@ class AccountInternal extends PureComponent {
[conditionsOpKey]: [...queryFilters, ...customQueryFilters], [conditionsOpKey]: [...queryFilters, ...customQueryFilters],
}); });
this.setState({ filterConditions: conditions }, () => { this.setState(
this.updateQuery(this.currentQuery, true); prevState => ({
}); filterConditions: append
? [...prevState.filterConditions, ...conditions]
: conditions,
}),
() => {
this.updateQuery(this.currentQuery, true);
},
);
} else { } else {
this.setState( this.setState(
{ {
@@ -1652,7 +1659,7 @@ class AccountInternal extends PureComponent {
this.setState({ isAdding: false }) this.setState({ isAdding: false })
} }
onCreatePayee={this.onCreatePayee} onCreatePayee={this.onCreatePayee}
onApplyFilters={conditions => this.applyFilters(conditions)} onApplyFilters={this.applyFilters}
/> />
</View> </View>
</View> </View>

View File

@@ -171,7 +171,7 @@ export function TransactionList({
const filterConditions = [ const filterConditions = [
{ field: 'notes', op: 'contains', value: noteTag, type: 'string' }, { field: 'notes', op: 'contains', value: noteTag, type: 'string' },
]; ];
onApplyFilters(filterConditions); onApplyFilters(filterConditions, true);
}); });
return ( return (