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 authored and Viicos committed Dec 6, 2023
1 parent 4395fce commit 647f2f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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
1 change: 0 additions & 1 deletion src/components/builder/values/items-expression.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {FormattedMessage} from 'react-intl';
import JSONEdit from '@/components/JSONEdit';
import {Component, Description} from '@/components/formio';
import {BuilderContext} from '@/context';
import {useValidationErrors} from '@/utils/errors';

const NAME = 'openForms.itemsExpression';

Expand Down

0 comments on commit 647f2f4

Please sign in to comment.