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 <NumberInput> state only changes on blur #8033

Merged
merged 5 commits into from
Aug 4, 2022
Merged

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Aug 3, 2022

<NumberInput> changes the form state on change, but only displays the string entered by the user.

Closes #7919

@fzaninotto
Copy link
Member Author

For some reason I don't understand, the isTouched attribute of the field state never changes, even though the 'touchedFields' from the form state is correct. We have the same problem on TextInput, so I believe the problem is in useInput, but I couldn't find it.

I've validated that the problem doesn't come from react-hook-form (cf https://codesandbox.io/s/useformstate-forked-i4rwpe?file=/src/App.js)

@fzaninotto
Copy link
Member Author

OK, so the bug is actually only happening in tests, and it's a react-hook-form bug (react-hook-form/react-hook-form#8786). I'll look for a workaround.

@fzaninotto fzaninotto merged commit 6327e43 into master Aug 4, 2022
@fzaninotto fzaninotto deleted the fix-numberinput branch August 4, 2022 07:54
@fzaninotto fzaninotto added this to the 4.2.6 milestone Aug 4, 2022
@fzaninotto fzaninotto changed the title Fix NumberInput state only changes on blur Fix <NumberInput> state only changes on blur Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing NumberInput does not set form dirty
3 participants