-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix application/json
with submitSource
=dom
#377
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
I tried writing a test for it, but kept on getting:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
packages/remix/src/useForm.tsx
Outdated
@@ -107,6 +107,10 @@ export function useForm<FormInputData extends FieldValues, FormOutputData>( | |||
if (!formData) | |||
throw new Error("Missing form data. This is likely a bug in RVF"); | |||
if (rvfOpts.id) formData.set(FORM_ID_FIELD_NAME, rvfOpts.id); | |||
|
|||
if (rvfOpts.encType === "application/json") { | |||
return Object.fromEntries(formData.entries()) as GenericObject; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the right place to change, but this won't handle nested data. You should be able to use preprocessFormData
from @rvf/core
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, done
For the tests, you need to run |
Thanks! |
Published as |
fixes #375