You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because of this line in createFormData(data: T, stringifyAll = true) in ./utilities/index.ts
if(stringifyAll){formData.append(key,JSON.stringify(value));// <---- This double quotes everything}else{formData.append(key,typeofvalue==="string" ? value : JSON.stringify(value),);}
So when accessing FormData in backend with formData.get('email') the result is "/"x@x.com/"" with double quoted string. What can be the workaround for this?
Currently I am setting stringifyAllValues: false and coercing all to strings in my zod schema.
The text was updated successfully, but these errors were encountered:
@vrn-hkz this is the intended behavior, if you're interested in why this is done you can find a detailed explanation here: react-hook-form/react-hook-form#11061 (comment)
I stringify it so I can preserve the original types and easily parse back to original values, you can use the "false" option to do that yourself obviously but then you would have to convert everything back manually, eg string number => number, string boolean => boolean
Because of this line in
createFormData(data: T, stringifyAll = true)
in./utilities/index.ts
So when accessing FormData in backend with
formData.get('email')
the result is"/"x@x.com/""
with double quoted string. What can be the workaround for this?Currently I am setting
stringifyAllValues: false
and coercing all to strings in my zod schema.The text was updated successfully, but these errors were encountered: