From acc8b77611f0a2955f78478aea61b206c235b3ba Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 29 Jan 2021 10:28:13 +0000 Subject: [PATCH] Fix validation on long form field --- .../src/forms/LongFormField.svelte | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/standard-components/src/forms/LongFormField.svelte b/packages/standard-components/src/forms/LongFormField.svelte index a9cd13de4a..c3bc8df26a 100644 --- a/packages/standard-components/src/forms/LongFormField.svelte +++ b/packages/standard-components/src/forms/LongFormField.svelte @@ -8,8 +8,17 @@ let fieldState let fieldApi - let value - $: fieldApi?.setValue(value) + let previousValue = "" + let value = "" + + $: { + // Only actually update the value when it changes, so that we don't trigger + // validation unnecessarily + if (value !== previousValue) { + fieldApi?.setValue(value) + previousValue = value + } + } // Options for rich text component const options = {