MCPcopy
hub / github.com/react-hook-form/react-hook-form / _setValid

Function _setValid

src/logic/createFormControl.ts:212–239  ·  view source on GitHub ↗
(shouldUpdateValid?: boolean)

Source from the content-addressed store, hash-verified

210 };
211
212 const _setValid = async (shouldUpdateValid?: boolean) => {
213 if (_state.keepIsValid) {
214 return;
215 }
216 if (
217 !_options.disabled &&
218 (_proxyFormState.isValid ||
219 _proxySubscribeFormState.isValid ||
220 shouldUpdateValid)
221 ) {
222 let isValid: boolean;
223 if (_options.resolver) {
224 isValid = isEmptyObject((await _runSchema()).errors);
225 _updateIsValidating();
226 } else {
227 isValid = await executeBuiltInValidation({
228 fields: _fields,
229 onlyCheckValid: true,
230 eventType: EVENTS.VALID,
231 });
232 }
233 if (isValid !== _formState.isValid) {
234 _subjects.state.next({
235 isValid,
236 });
237 }
238 }
239 };
240
241 const _updateIsValidating = (names?: string[], isValidating?: boolean) => {
242 if (

Callers 8

updateValidAndValueFunction · 0.85
setValuesFunction · 0.85
onChangeFunction · 0.85
triggerFunction · 0.85
unregisterFunction · 0.85
_setDisabledFieldFunction · 0.85
resetFieldFunction · 0.85
resetDefaultValuesFunction · 0.85

Calls 3

_runSchemaFunction · 0.85
_updateIsValidatingFunction · 0.85
executeBuiltInValidationFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…