fix reset validation
This commit is contained in:
parent
0581875dc3
commit
58ea7bba2d
@ -30,15 +30,10 @@ export const useValidation = ({
|
||||
|
||||
// inner validation && set validation status to store
|
||||
useEffect(() => {
|
||||
if (!validator) {
|
||||
return;
|
||||
}
|
||||
if (!value) {
|
||||
setValidation(undefined);
|
||||
calculationStore.setValidation(elementName, undefined);
|
||||
} else {
|
||||
const validationResult = validator(value);
|
||||
setValidation(validationResult);
|
||||
let validationResult = validator ? validator(value) : true;
|
||||
calculationStore.setValidation(elementName, validationResult);
|
||||
}
|
||||
}, [value, validator, elementName]);
|
||||
|
||||
Reference in New Issue
Block a user