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
Incorrect Slicing #1499
Comments
I'm also running into this. Making the code similar to the function sync(suggestions) { ... } would probably be cleaner..
Since we do the slice prior to "rendered" getting incremented, we should only slice off as many items as are available to fit within the limit. Since "rendered < that.limit" has already been tested by the if condition, then "that.limit - rendered" would always be positive and equal to the # of remaining items; |
- there is a bug in typeahead.js, twitter/typeahead.js#1499 - but is not being updated as project is dying. - a fork has applied the bugfix https://github.com/corejavascript/typeahead.js/blob/master/src/typeahead/dataset.js - but is also dying :( - apply patch manually. - maybe we should move to https://github.com/algolia/autocomplete.js ? - this may work with https://
Hi guys in slicing we are using (that.limit -rendered) in this if limit = 5 and rendered = 5 we won't be getting any output right ?
We need to use the minimum value of limit and rendered right ?
function async(suggestions) {
suggestions = suggestions || [];
if (!canceled && rendered < that.limit) {
that.cancel = $.noop;
rendered += suggestions.length;
that._append(query, suggestions.slice(0, that.limit < rendered ? that.limit : rendered));
that.async && that.trigger("asyncReceived", query);
}
This is my first time reporting an issue this solved my problem hope it's correct.
The text was updated successfully, but these errors were encountered: