-
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
Finish making InputControl
et al. more controllable
#40568
Merged
stokesman
merged 28 commits into
fix/input-field-reset-behavior
from
fix/input-field-reset-behavior-moar
May 11, 2022
Merged
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
f943b5b
Update `RangeControl` to play nice with revised `InputControl`
stokesman e662bde
Update `UnitControl` to play nice with revised `InputControl`
stokesman 0077735
Restore controlled mode to `RangeControl`
stokesman 295035c
Add missing ;
ciampo 739372f
Add comment after deleting `onChange`
ciampo cd1b4df
Update test of `RangeControl` to also test controlled mode
stokesman 9a3804f
Remove separate onChange call from reset handling in `RangeControl`
stokesman 4dc4674
Refine RESET logic of `InputControl` reducer
stokesman 302096d
Simplify refined RESET logic of `InputControl` reducer
stokesman f3c881f
Restore initial position of `RangeControl` when without value
stokesman 19fd100
Differentiate state sync effect hooks by event existence
stokesman 68a02ea
Add and use type `SecondaryReducer`
stokesman d6b43bb
Cleanup legacy `event.perist()`
stokesman b3e9d88
Simplify update from props in reducer
stokesman 547a7c7
Ensure event is cleared after drag actions
stokesman 89affab
Avoid declaration of potential unused variable
stokesman 06d16fd
Add more reset unit tests for `RangeControl`
stokesman ce0ac42
Run `RangeControl` unit test in both controlled/uncontrolled modes
stokesman 3800d28
Make “keep invaid values” test async
stokesman ff6e10a
Prevent interference of value entry in number input
stokesman e427a0e
Remove unused `floatClamp` function
stokesman 38c0158
Fix reset to `initialPosition`
stokesman 8930905
Fix a couple tests for controlled `RangeControl`
stokesman cb00749
Fix `RangeControl` reset
stokesman fa2723d
Ensure `InputControl`’s state syncing works after focus changes
stokesman 085fd03
Comment
stokesman 29634d7
Ignore NaN values in `useUnimpededRangedNumberEntry`
stokesman 2b14b0f
Refine use of event existence in state syncing effect hooks
stokesman 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
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
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
Oops, something went wrong.
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.
When does this happen (action without type)?
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.
That would be in what I'm calling the intake effect
gutenberg/packages/components/src/input-control/reducer/reducer.ts
Lines 218 to 226 in 2b14b0f
That was dispatching via
reset
in the base PR but in looking for a way to distinguish the update from props I landed on making the baredispatch
with no action type. I'd considered implementing another action (or bringing backupdate
that used to exist and was used only for this purpose (props coming in)) but I went with the baredispatch
because I thought it would make for a little less changes.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'd have just used another action but it's not important :)