From 063c0a7a8aa3c4e7278d05f4bc7009fb8b7ff7ac Mon Sep 17 00:00:00 2001 From: Raul de Melo Date: Wed, 31 Jul 2024 15:53:50 +0200 Subject: [PATCH] make event on handleSubmit function optional to match react-hook-form --- src/hook/index.tsx | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/hook/index.tsx b/src/hook/index.tsx index 154903f..9f6a65f 100644 --- a/src/hook/index.tsx +++ b/src/hook/index.tsx @@ -18,19 +18,19 @@ import { type SubmitErrorHandler, type SubmitHandler, useFormContext, + useForm, + FormProvider, + type DefaultValues, + type FieldValues, + type FormState, + type KeepStateOptions, + type Path, + type RegisterOptions, + type UseFormHandleSubmit, + type UseFormProps, + type UseFormReturn, } from "react-hook-form"; -import { useForm, FormProvider } from "react-hook-form"; -import type { - DefaultValues, - FieldValues, - FormState, - KeepStateOptions, - Path, - RegisterOptions, - UseFormHandleSubmit, - UseFormProps, - UseFormReturn, -} from "react-hook-form"; + import { createFormData } from "../utilities"; export type SubmitFunctionOptions = Parameters[1]; @@ -189,7 +189,7 @@ export const useRemixForm = ({ ); const handleSubmit = useMemo( - () => (e: FormEvent) => { + () => (e?: FormEvent) => { const encType = e?.currentTarget?.enctype as FormEncType | undefined; const method = e?.currentTarget?.method as FormMethod | undefined; const onValidHandler = submitHandlers?.onValid ?? onSubmit;