-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 NumberControl validation #34128
Fix NumberControl validation #34128
Conversation
Size Change: +202 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
👋 - thanks for working on this! I haven't seen in depth all the changes in your PR so but I'd expect to see something like changing an |
Hi Nik, thanks for the suggestion! I think your idea would probably work and, yes, likely with much less changes. I'm glad to give it go (and wish I'd tried that first 😢 😄 ) but I'll have to work on some other stuff before I can get back to this. |
@ntsekouras, I got around to trying your suggestion. I might have known what the catch would be but had forgotten. Modification of the value on While that's probably not a very common scenario, it is not easy to deal with specifically. Even if it were, it would also involve skipping some calls to I'm all ears in case I've overlooked something. |
69444ee
to
9b56eea
Compare
Closing in favor of #39260 that does much the same thing in a different way. |
This includes two changes to
NumberControl
behavior:onChange
with invalid valuesblur
The changed behaviors are covered by a couple of new unit tests. I'd manually verified the behavior before writing the tests and so was quite surprised that the unit tests would not pass. I never pinpointed the issue but, on a hunch, I tried memoizing the reducers used in
NumberControl
andInputControl
and that got the tests passing as expected. Since it seems better to have the reducers stable (so they don't run twice per render) the reducer forUnitControl
is also made so.How has this been tested?
Manually and unit tests. Part of the manual testing was
Types of changes
Bug fix: #33291
Checklist:
*.native.js
files for terms that need renaming or removal).