Skip to content

Commit

Permalink
Merge branch 'master' into trigger-validation-netsted-field
Browse files Browse the repository at this point in the history
  • Loading branch information
sungh0lim committed Jun 10, 2024
2 parents 2afdac6 + 1d0503b commit e60f895
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion reports/api-extractor.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ export type RegisterOptions<TFieldValues extends FieldValues = FieldValues, TFie
onChange?: (event: any) => void;
onBlur?: (event: any) => void;
disabled: boolean;
deps: InternalFieldName | InternalFieldName[];
deps: FieldPath<TFieldValues> | FieldPath<TFieldValues>[];
}> & ({
pattern?: ValidationRule<RegExp>;
valueAsNumber?: false;
Expand Down
8 changes: 5 additions & 3 deletions src/logic/createFormControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ export function createFormControl<
name,
};
const disabledField = !!(
get(_fields, name) && get(_fields, name)._f.disabled
get(_fields, name) &&
get(_fields, name)._f &&
get(_fields, name)._f.disabled
);

if (!isBlurEvent || shouldDirty) {
Expand Down Expand Up @@ -890,9 +892,9 @@ export function createFormControl<
) => ({
invalid: !!get((formState || _formState).errors, name),
isDirty: !!get((formState || _formState).dirtyFields, name),
isTouched: !!get((formState || _formState).touchedFields, name),
isValidating: !!get((formState || _formState).validatingFields, name),
error: get((formState || _formState).errors, name),
isValidating: !!get(_formState.validatingFields, name),
isTouched: !!get((formState || _formState).touchedFields, name),
});

const clearErrors: UseFormClearErrors<TFieldValues> = (name) => {
Expand Down
4 changes: 2 additions & 2 deletions src/types/validator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { INPUT_VALIDATION_RULES } from '../constants';

import { Message } from './errors';
import { FieldValues, InternalFieldName } from './fields';
import { FieldValues } from './fields';
import { FieldPath, FieldPathValue } from './path';

export type ValidationValue = boolean | number | string | RegExp;
Expand Down Expand Up @@ -45,7 +45,7 @@ export type RegisterOptions<
onChange?: (event: any) => void;
onBlur?: (event: any) => void;
disabled: boolean;
deps: InternalFieldName | InternalFieldName[];
deps: FieldPath<TFieldValues> | FieldPath<TFieldValues>[];
}> &
(
| {
Expand Down

0 comments on commit e60f895

Please sign in to comment.