-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[BUG] @refinedev/react-hook-form useForm not detecting changes correctly #6306
Comments
Hey @pcfreak30, could you share your form code with us? We could better understand with a reproducible example. We aren't quite sure how you handle inputs, so we need to check. |
@BatuhanW this is actively wip, so im using a specific commit hash, but you can see at https://github.com/LumeWeb/web/blob/5a41d85d272e977790b4d90623aa9b4a6d08f0a2/apps/portal-dashboard/app/routes/service/components/PinDialog.tsx i have a ugly workaround atm via:
I had AI try to create a minimal example, but I haven't tested it:
|
Hey @pcfreak30 👋, I've checked the code you've provided and investigated the issue for a bit. Looks like calling |
Um... could you please provide an example so im clear? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Describe the bug
I have been debugging the functionality for
warnWhenUnsavedChanges
and I found thatreact-hook-form
only ever emits a type with subscription event objects on blur?At https://github.com/refinedev/refine/blob/master/packages/react-hook-form/src/useForm/index.ts#L223-L230 your checking the type, which causes value changes to never trigger the
onValuesChange
callback and so the unsaved changed warn never works.Steps To Reproduce
react-hook-form
andwarnWhenUnsavedChanges
enabled. This should be inside a dialog.type
whenvalue
is passed.Expected behavior
warnWhenUnsavedChanges
should function correctly with state change detection enabling it.Packages
Additional Context
No response
The text was updated successfully, but these errors were encountered: