diff --git a/src/__tests__/logic/validateField.test.tsx b/src/__tests__/logic/validateField.test.tsx index dbdfca19efe..ce95aeec86d 100644 --- a/src/__tests__/logic/validateField.test.tsx +++ b/src/__tests__/logic/validateField.test.tsx @@ -36,6 +36,28 @@ describe('validateField', () => { }, }); + expect( + await validateField( + { + _f: { + mount: true, + name: 'test', + ref: { type: 'text', value: '', name: 'test' }, + required: true, + valueAsNumber: true, + }, + }, + NaN, + false, + ), + ).toEqual({ + test: { + ref: { type: 'text', value: '', name: 'test' }, + message: '', + type: 'required', + }, + }); + expect( await validateField( { diff --git a/src/logic/validateField.ts b/src/logic/validateField.ts index 13e66e4bc1d..48732b72b1c 100644 --- a/src/logic/validateField.ts +++ b/src/logic/validateField.ts @@ -66,6 +66,7 @@ export default async ( isUndefined(ref.value) && isUndefined(inputValue)) || inputValue === '' || + ref.value === '' || (Array.isArray(inputValue) && !inputValue.length); const appendErrorsCurry = appendErrors.bind( null,