From 8cbf6da7156d146a0d3e6306cf5302587cd7da62 Mon Sep 17 00:00:00 2001 From: attyluccio Date: Wed, 9 Oct 2024 00:37:04 +0200 Subject: [PATCH 1/4] Fixes #3585 - Fixes Rule Conditions Removal --- .../desktop-client/src/components/modals/EditRuleModal.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/desktop-client/src/components/modals/EditRuleModal.jsx b/packages/desktop-client/src/components/modals/EditRuleModal.jsx index 0ddd6fd8deb..1779ad69ec6 100644 --- a/packages/desktop-client/src/components/modals/EditRuleModal.jsx +++ b/packages/desktop-client/src/components/modals/EditRuleModal.jsx @@ -253,6 +253,7 @@ function ConditionEditor({ } else { valueEditor = ( ({ ...c, inputKey: uuid() })), ); const [actionSplits, setActionSplits] = useState(() => { const parsedActions = defaultRule.actions.map(parse); From 0231c8cc1b2a0385086b3458de6dc62d366386a0 Mon Sep 17 00:00:00 2001 From: attyluccio Date: Wed, 9 Oct 2024 00:55:16 +0200 Subject: [PATCH 2/4] Fixes #3585 - Fixes Rule Conditions Removal --- upcoming-release-notes/3607.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 upcoming-release-notes/3607.md diff --git a/upcoming-release-notes/3607.md b/upcoming-release-notes/3607.md new file mode 100644 index 00000000000..61ea0349d6b --- /dev/null +++ b/upcoming-release-notes/3607.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [attyluccio] +--- + +Fixes Rule Conditions Removal From d55e2e2ff3b752b353e3f5c07d158f93aa1ce362 Mon Sep 17 00:00:00 2001 From: vincenzo Date: Wed, 9 Oct 2024 09:55:27 +0200 Subject: [PATCH 3/4] Fixes #3585 - Fixes Rule Conditions Removal --- .../src/components/modals/EditRuleModal.jsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/desktop-client/src/components/modals/EditRuleModal.jsx b/packages/desktop-client/src/components/modals/EditRuleModal.jsx index 1779ad69ec6..b02a6df5a60 100644 --- a/packages/desktop-client/src/components/modals/EditRuleModal.jsx +++ b/packages/desktop-client/src/components/modals/EditRuleModal.jsx @@ -231,7 +231,15 @@ function ConditionEditor({ onDelete, onAdd, }) { - const { field: originalField, op, value, type, options, error } = condition; + const { + field: originalField, + op, + value, + type, + options, + error, + inputKey, + } = condition; let field = originalField; if (field === 'amount' && options) { @@ -246,6 +254,7 @@ function ConditionEditor({ if (type === 'number' && op === 'isbetween') { valueEditor = ( onChange('value', v)} /> @@ -253,7 +262,7 @@ function ConditionEditor({ } else { valueEditor = ( Date: Fri, 11 Oct 2024 19:25:04 +0200 Subject: [PATCH 4/4] fixed #3585 inputKey on ActionEditor --- .../desktop-client/src/components/modals/EditRuleModal.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/desktop-client/src/components/modals/EditRuleModal.jsx b/packages/desktop-client/src/components/modals/EditRuleModal.jsx index 1779ad69ec6..b4e65db3f71 100644 --- a/packages/desktop-client/src/components/modals/EditRuleModal.jsx +++ b/packages/desktop-client/src/components/modals/EditRuleModal.jsx @@ -752,7 +752,7 @@ export function EditRuleModal({ defaultRule, onSave: originalOnSave }) { (acc, action) => { const splitIndex = action.options?.splitIndex ?? 0; acc[splitIndex] = acc[splitIndex] ?? { id: uuid(), actions: [] }; - acc[splitIndex].actions.push(action); + acc[splitIndex].actions.push({ ...action, inputKey: uuid() }); return acc; }, // The pre-split group is always there @@ -823,6 +823,7 @@ export function EditRuleModal({ defaultRule, onSave: originalOnSave }) { op: 'set-split-amount', options: { method: 'remainder', splitIndex }, value: null, + inputKey: uuid(), }; } else { const fieldsArray = splitIndex === 0 ? actionFields : splitActionFields; @@ -837,6 +838,7 @@ export function EditRuleModal({ defaultRule, onSave: originalOnSave }) { op: 'set', value: null, options: { splitIndex }, + inputKey: uuid(), }; }