1
0
Fork 0
mirror of synced 2024-07-02 21:10:43 +12:00

Fix bug with resetting operators when an incompatible value type is chosen

This commit is contained in:
Andrew Kingston 2021-07-26 12:56:47 +01:00
parent 41953e049d
commit 5094e5814e
2 changed files with 6 additions and 6 deletions

View file

@ -125,10 +125,9 @@
condition.referenceValue = null
// Ensure a valid operator is set
const validOperators = getValidOperatorsForType(newType)
const validOperators = getValidOperatorsForType(newType).map(x => x.value)
if (!validOperators.includes(condition.operator)) {
condition.operator =
validOperators[0]?.value ?? OperatorOptions.Equals.value
condition.operator = validOperators[0] ?? OperatorOptions.Equals.value
onOperatorChange(condition, condition.operator)
}
}

View file

@ -47,10 +47,11 @@
expression.type = schemaFields.find(x => x.name === field)?.type
// Ensure a valid operator is set
const validOperators = getValidOperatorsForType(expression.type)
const validOperators = getValidOperatorsForType(expression.type).map(
x => x.value
)
if (!validOperators.includes(expression.operator)) {
expression.operator =
validOperators[0]?.value ?? OperatorOptions.Equals.value
expression.operator = validOperators[0] ?? OperatorOptions.Equals.value
onOperatorChange(expression, expression.operator)
}
}