Fix bug with resetting operators when an incompatible value type is chosen
This commit is contained in:
parent
38df0b54a5
commit
8a09494348
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue