-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(Dropdown): Add minCharacters prop #1690
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1690 +/- ##
==========================================
- Coverage 99.75% 99.75% -0.01%
==========================================
Files 141 141
Lines 2412 2411 -1
==========================================
- Hits 2406 2405 -1
Misses 6 6
Continue to review full report at Codecov.
|
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.
Changes look great. Just a couple code style comments for addressing please.
src/modules/Dropdown/Dropdown.js
Outdated
@@ -714,13 +718,15 @@ export default class Dropdown extends Component { | |||
|
|||
if (onSearchChange) onSearchChange(e, newQuery) | |||
|
|||
// open search dropdown on search query | |||
if (search && newQuery && !open) this.open() | |||
if (newQuery.length >= this.props.minCharacters) { |
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.
In keeping with the code style, please destructure minCharacters
on line 715.
@@ -1604,6 +1604,19 @@ describe('Dropdown', () => { | |||
dropdownMenuIsOpen() | |||
}) | |||
|
|||
it('Don\'t open the menu on change if query\'s length is less than minCharacters', () => { |
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 a string includes single quote characters, please quote it with double quotes to prevent escaping.
Regarding |
Thanks much, will merge on pass. |
You're welcome |
Released in |
I've added minCharacters props in Dropdown as requested in #1124. Now we can set the minimum characters for a search to begin showing results.
I also would like to add saveRemoteData but I'm wondered if it's not useless. Because someone will use Flux' store and someone else the Redux' store and the other the locale storage.
So should I use locale storage to implement saveRemoteData?