Skip to content

Commit

Permalink
πŸ‹πŸ»β€β™€οΈ reduce package size (#9778)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluebill1049 committed Jan 16, 2023
1 parent a500857 commit 6d44fcd
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/logic/createFormControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ export function createFormControl<
: await executeBuiltInValidation(_fields, true);

if (isValid !== _formState.isValid) {
_formState.isValid = isValid;
_subjects.state.next({
isValid,
});
Expand Down Expand Up @@ -632,11 +631,9 @@ export function createFormControl<
(_proxyFormState.isDirty || _proxyFormState.dirtyFields) &&
options.shouldDirty
) {
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);

_subjects.state.next({
name,
dirtyFields: _formState.dirtyFields,
dirtyFields: getDirtyFields(_defaultValues, _formValues),
isDirty: _getDirty(name, cloneValue),
});
}
Expand Down Expand Up @@ -840,14 +837,13 @@ export function createFormControl<
});

const clearErrors: UseFormClearErrors<TFieldValues> = (name) => {
name
? convertToArrayPayload(name).forEach((inputName) =>
unset(_formState.errors, inputName),
)
: (_formState.errors = {});
name &&
convertToArrayPayload(name).forEach((inputName) =>
unset(_formState.errors, inputName),
);

_subjects.state.next({
errors: _formState.errors,
errors: name ? _formState.errors : {},
});
};

Expand Down

0 comments on commit 6d44fcd

Please sign in to comment.