remix-hook-form
Advanced tools
Comparing version 4.0.1 to 4.1.0
import * as react_hook_form from 'react-hook-form'; | ||
import { FieldValues, Resolver, FieldErrors, UseFormProps, SubmitHandler, SubmitErrorHandler, DefaultValues, Path, RegisterOptions, UseFormReturn } from 'react-hook-form'; | ||
import { FieldValues, Resolver, FieldErrors, UseFormProps, SubmitHandler, SubmitErrorHandler, DefaultValues, KeepStateOptions, Path, RegisterOptions, UseFormReturn } from 'react-hook-form'; | ||
import React from 'react'; | ||
@@ -73,3 +73,3 @@ import { SubmitFunction, FetcherWithComponents } from '@remix-run/react'; | ||
handleSubmit: (e?: React.BaseSyntheticEvent<object, any, any> | undefined) => Promise<void>; | ||
reset: (values?: T | DefaultValues<T> | undefined) => void; | ||
reset: (values?: T | DefaultValues<T> | undefined, options?: KeepStateOptions) => void; | ||
register: (name: Path<T>, options?: (RegisterOptions<T> & { | ||
@@ -76,0 +76,0 @@ disableProgressiveEnhancement?: boolean | undefined; |
@@ -82,6 +82,9 @@ // src/utilities/index.ts | ||
} else { | ||
formData.append( | ||
key, | ||
typeof value === "string" ? value : JSON.stringify(value) | ||
); | ||
if (typeof value === "string") { | ||
formData.append(key, value); | ||
} else if (value instanceof Date) { | ||
formData.append(key, value.toISOString()); | ||
} else { | ||
formData.append(key, JSON.stringify(value)); | ||
} | ||
} | ||
@@ -158,5 +161,5 @@ } | ||
), | ||
reset: (values) => { | ||
reset: (values, options) => { | ||
setIsSubmittedSuccessfully(false); | ||
methods.reset(values); | ||
methods.reset(values, options); | ||
}, | ||
@@ -163,0 +166,0 @@ register: (name, options) => { |
{ | ||
"name": "remix-hook-form", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "Utility wrapper around react-hook-form for use with Remix.run", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
49298
594