-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
added suggestion limit prop to AutocompleteInput #2427
added suggestion limit prop to AutocompleteInput #2427
Conversation
@djhi I need this improvement also. |
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.
New features should be pulled against the next
branch, not master
.
@@ -455,6 +462,7 @@ export class AutocompleteInput extends React.Component { | |||
options, | |||
} = this.props; | |||
const { suggestions, searchText } = this.state; | |||
const slicedSuggestions = this.sliceSuggestions(suggestions); |
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.
The result will be a new array for each render()
, which will force a rerender of the autosuggest even if the suggestions didn't change. This is bad, so you should slice when setting the suggestions in the state, not when reading the state.
@@ -520,6 +528,7 @@ AutocompleteInput.propTypes = { | |||
translate: PropTypes.func.isRequired, | |||
translateChoice: PropTypes.bool.isRequired, | |||
inputValueMatcher: PropTypes.func, | |||
suggestionLimit: PropTypes.number, |
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.
please document and unit test this new prop
Okay, Will do. |
Hi! Could you find a few minutes tu update your PR? |
No news for too long, closing. |
No description provided.