Closed edbella closed 2 months ago
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch remix-hook-form@4.3.1 for the project I'm working on.
remix-hook-form@4.3.1
Here is the diff that solved my problem:
diff --git a/node_modules/remix-hook-form/dist/index.js b/node_modules/remix-hook-form/dist/index.js index 6fd94e4..cd0637a 100644 --- a/node_modules/remix-hook-form/dist/index.js +++ b/node_modules/remix-hook-form/dist/index.js @@ -130,8 +130,9 @@ var useRemixForm = ({ const onSubmit = useMemo( () => (data2) => { setIsSubmittedSuccessfully(true); - const formData = createFormData( - { ...data2, ...submitData }, + const submitPayload = { ...data2, ...submitData }; + const formData = submitConfig?.encType === 'application/json' ? submitPayload : createFormData( + submitPayload, stringifyAllValues ); submit(formData, {
I noticed that when I set the encType value to application/json in the submitConfig, the data being sent still remained as FormData.
encType
application/json
submitConfig
FormData
This issue body was partially generated by patch-package.
Yes please! This is super important to me as I'm trying to also use the useFieldArray from react-hook-form.
I believe you should make this into an PR.
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch
remix-hook-form@4.3.1
for the project I'm working on.Here is the diff that solved my problem:
I noticed that when I set the
encType
value toapplication/json
in thesubmitConfig
, the data being sent still remained asFormData
.This issue body was partially generated by patch-package.