Grafana/ui: Expose trigger method from useForm to children (#73831)

Form: Expose trigger method from useForm to children
This commit is contained in:
Javier Ruiz 2023-08-31 10:22:07 +01:00 committed by GitHub
parent 485f07cb7d
commit 6dea273044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ export function Form<T extends FieldValues>({
onSubmit={handleSubmit(onSubmit)}
{...htmlProps}
>
{children({ errors: formState.errors, formState, ...rest })}
{children({ errors: formState.errors, formState, trigger, ...rest })}
</form>
);
}

View File

@ -1,7 +1,7 @@
import { UseFormReturn, FieldValues, FieldErrors, FieldArrayMethodProps } from 'react-hook-form';
export type { SubmitHandler as FormsOnSubmit, FieldErrors as FormFieldErrors } from 'react-hook-form';
export type FormAPI<T extends FieldValues> = Omit<UseFormReturn<T>, 'trigger' | 'handleSubmit'> & {
export type FormAPI<T extends FieldValues> = Omit<UseFormReturn<T>, 'handleSubmit'> & {
errors: FieldErrors<T>;
};