Skip to content
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

Closed

Conversation

mohinderps
Copy link

No description provided.

@oksuz
Copy link
Contributor

oksuz commented Oct 17, 2018

@djhi I need this improvement also.

Copy link
Member

@fzaninotto fzaninotto left a 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);
Copy link
Member

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,
Copy link
Member

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

@mohinderps
Copy link
Author

Okay, Will do.

@fzaninotto
Copy link
Member

Hi! Could you find a few minutes tu update your PR?

@fzaninotto
Copy link
Member

No news for too long, closing.

@fzaninotto fzaninotto closed this Dec 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants