Stop app crashing when rule is configured incorrectly (#7574)

* catch the error instead of crashing the app if validatePayload fails

* Don't attempt validatePayload with invalid rule

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
Nitwel
2021-08-26 23:54:40 +02:00
committed by GitHub
parent 071e313bce
commit 207eb0bfc3

View File

@@ -237,8 +237,10 @@ export default defineComponent({
const conditions = [...field.meta.conditions].reverse();
const matchingCondition = conditions.find((condition) => {
if (!condition.rule) return;
if (!condition.rule || Object.keys(condition.rule).length !== 1) return;
const errors = validatePayload(condition.rule, values.value, { requireAll: true });
return errors.length === 0;
});