mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-27 09:38:09 -05:00
committed by
GitHub
parent
05dda5f9d7
commit
300ddc6311
@@ -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 = (
|
||||
<BetweenAmountInput
|
||||
key={inputKey}
|
||||
defaultValue={value}
|
||||
onChange={v => onChange('value', v)}
|
||||
/>
|
||||
@@ -253,6 +262,7 @@ function ConditionEditor({
|
||||
} else {
|
||||
valueEditor = (
|
||||
<GenericInput
|
||||
key={inputKey}
|
||||
field={field}
|
||||
type={type}
|
||||
value={value}
|
||||
@@ -547,7 +557,7 @@ function StageButton({ selected, children, style, onSelect }) {
|
||||
}
|
||||
|
||||
function newInput(item) {
|
||||
return { ...item, inputKey: '' + Math.random() };
|
||||
return { ...item, inputKey: uuid() };
|
||||
}
|
||||
|
||||
function ConditionsList({
|
||||
@@ -579,6 +589,7 @@ function ConditionsList({
|
||||
field,
|
||||
op: 'is',
|
||||
value: null,
|
||||
inputKey: uuid(),
|
||||
});
|
||||
onChangeConditions(copy);
|
||||
}
|
||||
@@ -742,7 +753,7 @@ const conditionFields = [
|
||||
|
||||
export function EditRuleModal({ defaultRule, onSave: originalOnSave }) {
|
||||
const [conditions, setConditions] = useState(
|
||||
defaultRule.conditions.map(parse),
|
||||
defaultRule.conditions.map(parse).map(c => ({ ...c, inputKey: uuid() })),
|
||||
);
|
||||
const [actionSplits, setActionSplits] = useState(() => {
|
||||
const parsedActions = defaultRule.actions.map(parse);
|
||||
@@ -750,7 +761,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
|
||||
@@ -821,6 +832,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;
|
||||
@@ -835,6 +847,7 @@ export function EditRuleModal({ defaultRule, onSave: originalOnSave }) {
|
||||
op: 'set',
|
||||
value: null,
|
||||
options: { splitIndex },
|
||||
inputKey: uuid(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
6
upcoming-release-notes/3607.md
Normal file
6
upcoming-release-notes/3607.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [attyluccio]
|
||||
---
|
||||
|
||||
Fixes Rule Conditions Removal
|
||||
Reference in New Issue
Block a user