-
Notifications
You must be signed in to change notification settings - Fork 105
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
Auto-updating the field's value breaks when not using useForm's defaultValue #771
Comments
Same issue if my isActive boolean default value is set to true the form won't pick up the value until I turn the value off and then on again |
Thanks for the writeup. I have gave it some thoughts last night and my current plan is to make this opt-in with an option to customize the behavior. I will put up a draft PR with more information later today. Sorry for the trouble! |
That'd be perfect, thanks for the quick turnaround. It's really appreciated 👍 |
We have just noticed this… I am now conflicted about what pattern I prefer! |
I have put up a fix on #775. Can you give the pre-release a try and let me know if you run into any issues? Thanks. |
Tested these pre-release versions and no longer running into issues with my inputs being cleared due to the lack of |
I'm sorry for the trouble. I've concluded that it's best to revert the relevant changes, and I've just published v1.2.2. |
That works as well! Already tested |
Describe the bug and the expected behavior
Before #729 went in I could have something like this:
The input was properly initialised with the provided default value and that'd be it. With the #729, either we provide a
defaultValue
to theuseForm
hook or the input's value will be overwritten to an empty text input / unchecked radio or checkbox.I think such a change could either be marked as a major upgrade since the documentation / previous versions did not force users to provide the
defaultValue
to the useForm hook when wanting to pass a default value to their inputs - meaning that inputs that are initialised "out of the useForm realm" will be overwritten. Not necessarily arguing that this is better than using thedefaultValue
property inuseForm
since I can see arguments for both side, but it definitely caught me off-guard and broke my edit forms since they would be all empty by bumping to this version.Or it could make sure that it only overwrites stuff if the
defaultValue
is provided and input is currently empty.Conform version
v1.2.1
Steps to Reproduce the Bug or Issue
In here we can assert that the input will in fact be changed to an empty one.
What browsers are you seeing the problem on?
Chrome, Firefox, Microsoft Edge, Safari
Screenshots or Videos
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: