From 1750cd908179b065b58b1a5b2cc2b2ca7c7a5ba8 Mon Sep 17 00:00:00 2001 From: lelemm Date: Sat, 24 Aug 2024 05:49:36 -0300 Subject: [PATCH] Filter fix when alternating all <-> any (#3278) --- .../src/components/accounts/Account.jsx | 4 ++-- .../src/components/filters/FiltersStack.tsx | 2 +- .../src/components/modals/EditRule.jsx | 12 ++++++++---- upcoming-release-notes/3278.md | 6 ++++++ 4 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 upcoming-release-notes/3278.md diff --git a/packages/desktop-client/src/components/accounts/Account.jsx b/packages/desktop-client/src/components/accounts/Account.jsx index 01bcc5abd85..b946bcbabae 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 3af0c68b736..02576c5de1d 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 ( diff --git a/packages/desktop-client/src/components/modals/EditRule.jsx b/packages/desktop-client/src/components/modals/EditRule.jsx index c36e331dc95..c409c77f51a 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 }} /> @@ -260,7 +260,11 @@ function ConditionEditor({ return ( - + onChange('field', value)} + /> {valueEditor} @@ -373,7 +377,7 @@ function ActionEditor({ action, editorStyle, onChange, onDelete, onAdd }) { onChange('field', value)} /> @@ -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 00000000000..49cbfcaf6e3 --- /dev/null +++ b/upcoming-release-notes/3278.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [lelemm] +--- + +Filter fix when alternating all <-> any