xenial-black
xenial-black12mo ago

Calling reset() removes the whole value from field

I have upgraded to refine 4 , I am using useForm for handling forms, for some reason when I am calling reset() then it is removing the whole value from the field, instead it should be replacing the changed values to the initial values. Can anyone help me if reset() behaviour is changed for @refinedev/react-hook-form (useForm)
4 Replies
kapa.ai
kapa.ai12mo ago
Hi @ag_abhay_gupta. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The extracts provided do not contain specific information about the behavior of the reset() function in the useForm hook from @refinedev/react-hook-form in refine 4. However, it's worth noting that in refine 4, all react-hook-form imports re-exported from @pankod/refine-react-hook-form have been removed. You now need to import them from the react-hook-form package directly. If the package is not installed, you can install it with your package manager. After that, you can import them from react-hook-form package directly.
npm install react-hook-form
npm install react-hook-form
import { useForm } from "@refinedev/react-hook-form";
import { Controller } from "react-hook-form";
import { useForm } from "@refinedev/react-hook-form";
import { Controller } from "react-hook-form";
(Source: Migration Guide from 3.x.x to 4.x.x (https://refine.dev/docs/migration-guide/3x-to-4x)) For more detailed information, I would recommend checking the official documentation of useForm (https://refine.dev/docs/packages/documentation/react-hook-form/useForm) in refine and React Hook Form (https://react-hook-form.com/). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai12mo ago
<@1083281686692909056> kapa.ai is still learning and improving, please let us know how it did by reacting below
grumpy-cyan
grumpy-cyan12mo ago
Hello, @ag_abhay_gupta react-hook-form import path has changed. You can access the migration guide from the link below. Maybe the react-hook-form reset usage has changed with the version update. You can check this in the react-hook-form documentation. https://refine.dev/docs/migration-guide/3x-to-4x/#import-changes-6
Migrating from 3.x.x to 4.x.x | refine
Motivation behind the release
xenial-black
xenial-black12mo ago
Ok I will check it, thank you