-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(number-input): adjust invalid logic and add proptype check for value #5217
Merged
Merged
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c375523
fix(number-input): adjust invalid logic and add proptype check for value
abbeyhrt 2312b6e
fix(number-input): remove only from tests
abbeyhrt 9967158
Merge branch 'master' into fix-4294
tw15egan 59a12bb
Merge branch 'master' into fix-4294
tw15egan 7278f6f
Merge branch 'master' into fix-4294
abbeyhrt c4e0786
Update packages/react/src/components/NumberInput/NumberInput.js
abbeyhrt bddf497
Merge branch 'master' into fix-4294
joshblack 07072b8
fix(number-input): check for controlled state feature flag
abbeyhrt eb63534
Merge branch 'master' into fix-4294
abbeyhrt ad78667
Merge branch 'master' into fix-4294
abbeyhrt 632a0c2
Merge branch 'master' into fix-4294
abbeyhrt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null
value, which means changing the state to the returning value, whenevervalue
prop is an empty string andvalue
state is not an empty string causes canceling any state update (to non-empty string, e.g. upon up/down buttons or user's type) ifvalue
prop is an empty string. The problem is observed with<NumberInput value="" />
where it doesn't allow user to make any edit at all. Wondering if you simply wanted to detect update invalue
prop to an empty string, which led to my suggestion above. Note thatgDSFP
is called for state update requests in addition to prop updates.useControlledStateWithValue
flag must make the entiregDSFP
no-op (by returningnull
). The purpose of flaguseControlledStateWithValue
is not doing anyvalue
state update fromvalue
proptypeof value === 'string'
is redundant if we are doing strict equal check ofvalue
with an empty string (given strict equal check involves type checking)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abbeyhrt Any thoughts on this...? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make the changes for the last two points, those seem good to me 👍 Could you help me understand your first point? The intent behind it was to prevent anybody from setting the value to anything but an empty string or a number, could you provide steps for me to reproduce the problem if
value
is set to an empty string?