Skip to content

A local-first personal finance app

Filter fix when alternating all <-> any (#3278)

lelemm1750cd908179
diff --git a/packages/desktop-client/src/components/accounts/Account.jsx b/packages/desktop-client/src/components/accounts/Account.jsx
index 01bcc5abd8..b946bcbaba 100644
--- a/packages/desktop-client/src/components/accounts/Account.jsx
+++ b/packages/desktop-client/src/components/accounts/Account.jsx
@@ -1113,10 +1113,10 @@ class AccountInternal extends PureComponent {
);
};
- onConditionsOpChange = (value, conditions) => {
+ onConditionsOpChange = value => {
this.setState({ filterConditionsOp: value });
this.setState({ filterId: { ...this.state.filterId, status: 'changed' } });
- this.applyFilters([...conditions]);
+ this.applyFilters([...this.state.filterConditions]);
if (this.state.search !== '') {
this.onSearch(this.state.search);
}
diff --git a/packages/desktop-client/src/components/filters/FiltersStack.tsx b/packages/desktop-client/src/components/filters/FiltersStack.tsx
index 3af0c68b73..02576c5de1 100644
--- a/packages/desktop-client/src/components/filters/FiltersStack.tsx
+++ b/packages/desktop-client/src/components/filters/FiltersStack.tsx
@@ -34,7 +34,7 @@ export function FiltersStack({
onReloadSavedFilter: (savedFilter: SavedFilter, value?: string) => void;
filterId: SavedFilter;
savedFilters: TransactionFilterEntity[];
- onConditionsOpChange: () => void;
+ onConditionsOpChange: (value: 'and' | 'or') => void;
}) {
return (
<View>
diff --git a/packages/desktop-client/src/components/modals/EditRule.jsx b/packages/desktop-client/src/components/modals/EditRule.jsx
index c36e331dc9..c409c77f51 100644
--- a/packages/desktop-client/src/components/modals/EditRule.jsx
+++ b/packages/desktop-client/src/components/modals/EditRule.jsx
@@ -94,7 +94,7 @@ export function FieldSelect({ fields, style, value, onChange }) {
bare
options={fields}
value={value}
- onChange={value => onChange('field', value)}
+ onChange={onChange}
buttonStyle={{ color: theme.pageTextPositive }}
/>
</View>
@@ -260,7 +260,11 @@ function ConditionEditor({
return (
<Editor style={editorStyle} error={error}>
- <FieldSelect fields={conditionFields} value={field} onChange={onChange} />
+ <FieldSelect
+ fields={conditionFields}
+ value={field}
+ onChange={value => onChange('field', value)}
+ />
<OpSelect ops={ops} value={op} type={type} onChange={onChange} />
<View style={{ flex: 1 }}>{valueEditor}</View>
@@ -373,7 +377,7 @@ function ActionEditor({ action, editorStyle, onChange, onDelete, onAdd }) {
<FieldSelect
fields={options?.splitIndex ? splitActionFields : actionFields}
value={field}
- onChange={onChange}
+ onChange={value => onChange('field', value)}
/>
<View style={{ flex: 1 }}>
@@ -838,7 +842,7 @@ export function EditRule({ defaultRule, onSave: originalOnSave }) {
setStage(stage);
}
- function onChangeConditionsOp(name, value) {
+ function onChangeConditionsOp(value) {
setConditionsOp(value);
}
diff --git a/upcoming-release-notes/3278.md b/upcoming-release-notes/3278.md
new file mode 100644
index 0000000000..49cbfcaf6e
--- /dev/null
+++ b/upcoming-release-notes/3278.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [lelemm]
+---
+
+Filter fix when alternating all <-> any