From 207eb0bfc36723e8abcd6ed35a33f722e738ca12 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Thu, 26 Aug 2021 23:54:40 +0200 Subject: [PATCH] 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 --- app/src/components/v-form/v-form.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/components/v-form/v-form.vue b/app/src/components/v-form/v-form.vue index 1484d7678e..3bfbd9770f 100644 --- a/app/src/components/v-form/v-form.vue +++ b/app/src/components/v-form/v-form.vue @@ -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; });