-
Notifications
You must be signed in to change notification settings - Fork 101
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
[1.0.0] empty string defaultValue not applied via prop getters #424
Comments
What you found is a side effect of the normalization process within Conform. This includes serializing all the primitves, e.g. I think this shouldn't be too much of a problem in general. Just something should have been documented to avoid surprise? |
Ok, so it is intentional - interesting. In that case, the user-land solution would be applying |
I would recommend It is not intentional but more a side effect I didn't aware 😅. I might be able to "fix" it by delaying when the normalization happens but there could be other trade-offs doing this as well. |
OK, thanks for clarifying. |
@edmundhung I also ran into this today, when updating |
@lifeiscontent Are you sure you have passed the new If this doesn't fix your issue, please open a new issue with a repo 🙏🏼 |
We also encountered this issue. It forces us to use |
@depsimon This was referring to the |
Definitely, I've created a dedicated issue. |
Describe the bug and the expected behavior
I want to default a select input to a disabled option with a value of
""
(the empty string). I setuseForm
'sdefaultValue
option, but it seems to have no effect? I can configure the select element manually by applying thedefaultValue=""
prop, but I expected that to happen automatically (coming fromgetSelectProps
).Note: I also tried a combination of approaches by applying
defaultValue={fields.myField.initialValue}
ordefaultValue={form.initialValue?.myField}
, but that didn't help as both areundefined
.Conform version
v1.0.0
Steps to Reproduce the Bug or Issue
Full reproduction with native input comparison here:
https://stackblitz.com/edit/remix-run-remix-q8mz1z?file=app%2Froutes%2F_index.tsx
What browsers are you seeing the problem on?
Chrome, Firefox, Microsoft Edge, Safari, Others
Screenshots or Videos
No response
Additional context
This seems to only be a bug with regards to the empty string as a default value. Using non-empty values behaves as expected. But the empty string is a valid value, IMHO, and should behave as such.
The text was updated successfully, but these errors were encountered: