Closed bethmaloney closed 4 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
react-hook-form-material-ui | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jul 2, 2024 1:40am |
Sorry need to rebuild storybook
Rebuilt storybook. Should be good to go.
Please release
@bethmaloney thanks for your time an contribution. I just got back from holiday and straight caught a bad cold thats why my response (and brain) still a bit slow. There are minor concerns but currently your changes would change an empty string into a "0" thats where we need to look at as first. I merged your other PR's already they where 👍 thanks
Hi @dohomi no problems. Let me fix that up
Thinking about it a bit more I think it makes sense for a TextFieldElement with type='number' to return Number | null | undefined
.
null | undefined
would be returned when the field is blank while Number is returned when the field is not empty. The other option would be to return Number | undefined | ''
. I feel that checking if the return value is undefined or a string would feel a little strange and might surprise consumers. Let me know what you think. Below is the behaviour of the changes I've just pushed (happy to change however you'd like).
No Default Value
Value added and cleared
0 value
Other value
Currently we do a falsy check on the input/output of the TextFieldElement. As
0
is a falsy value this means that we return null or an empty string.To fix this we check if the value is nullish instead.
You can test it by using the Number input control and inputting 0. Previously it would show a blank value but now it shows 0.