Skip to content

Commit

Permalink
🥔[open-formulieren/open-forms#3597] Fix validateOnChange
Browse files Browse the repository at this point in the history
It still lags a bit, but it's close to on change. Small edits aren't
detected immediately.
  • Loading branch information
CharString committed Dec 6, 2023
1 parent 0e838f6 commit 9c8e830
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/JSONEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const JSONEdit: React.FC<JSONEditProps & TextareaHTMLAttributes<HTMLTextAreaElem

const [value, setValue] = useState(dataAsJSON);
const [JSONValid, setJSONValid] = useState(true);
const {setValues, setFieldValue} = useFormikContext();
const {setValues, setFieldValue, validateField} = useFormikContext();

// if no name is provided, replace the entire form state, otherwise only set a
// specific value
Expand All @@ -46,6 +46,7 @@ const JSONEdit: React.FC<JSONEditProps & TextareaHTMLAttributes<HTMLTextAreaElem
}

updateValue(updatedData);
name && validateField(name);
};
return (
<>
Expand Down

0 comments on commit 9c8e830

Please sign in to comment.