Skip to content
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

Fix useInput resetting NumberInput when value = 0 #6375

Closed
wants to merge 1 commit into from

Conversation

andion
Copy link

@andion andion commented Jun 21, 2021

This issue was making every NumberInput change its value to its defaultValue or initialValue when it reaches zero.

If you try to do this: <NumberInput source="test" min={-10} max={10} defaultValue={6} />

It will go back to 6 when it reaches 0, like this

l6tTZFrzAg

I don't know if there are more side-effects not considered, but this fixes the said issue.

This issue was making every NumberInput go to its defaultValue or initialValue when you change it to zero. You can see the effect here: http://g.recordit.co/l6tTZFrzAg.gif

I don't know if there are more side-effects not considered, but this fixes the said issue.
Copy link
Collaborator

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks but I actually opened a PR at the same time, with tests (#6374)

@andion
Copy link
Author

andion commented Jun 21, 2021

Great, thank you! I guess you saw my comment from earlier. It's so easy to miss those, so I wanted to send a quick PR.

@andion andion closed this Jun 21, 2021
@andion
Copy link
Author

andion commented Jun 21, 2021

Already fixed in #6374

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants