23 Replies
If useForm's queryResult is returning results then the problem cannot be here
fair-rose•3y ago
Correct
Can you check your network requests? There we can find the wrong request
fair-rose•3y ago
This is the query that is being sent out:
query ($id: ID!) { user (id: $id) }
And this is the message in the response: Field "user" of type "UserWithRoles" must have a selection of subfields. Did you mean "user { ... }"?
Does the error go away when you remove the useForm?
fair-rose•3y ago
Haven't tried that
Give me minute
Yes, its still there
Let's try to remove useList as well
fair-rose•3y ago
Just caught it
It's coming from
const { register, handleSubmit } = useReactHookForm({ }
Import statement of the same: import { useForm as useReactHookForm } from '@pankod/refine-react-hook-form'
hmm why did you import two forms?
fair-rose•3y ago
Both are two different things right?
@pankod/refine-react-hook-form package extends useForm already in core. So just use @pankod/refine-react-hook-form
fair-rose•3y ago
Ohh
fair-rose•3y ago
Will this be a good example for me to follow?
https://github.com/pankod/refine/blob/master/examples/form/mui/useForm/src/pages/posts/edit.tsx
Yes definitely, you can have a look here to use the properties in core
https://refine.dev/docs/packages/documentation/react-hook-form/useForm/#properties
fair-rose•3y ago
Working fine now
Thank you soo much Ömer
Wouldn't have found this if it was not for you
Hooray!! Do you think we should update the document so others don't make this mistake?
fair-rose•3y ago
Yes definitely, I have gone through the documentation many times, but never came across this
It will be a great help for everybody
Great, what kind of enhancement do you think would work?
fair-rose•3y ago
My bad, its already there.
fair-rose•3y ago
Dunno how I missed it
fair-rose•3y ago
useForm | refine
refine offers a React Hook Form adapter(@pankod/refine-react-hook-form) that allows you to use the React Hook Form library with refine. Thus, you can manage your forms in headless way.
ohh okay, thank you! 🎁