Typeahead.js: No results when dataset limit is exactly the same as server response items

Created on 20 Oct 2016  路  4Comments  路  Source: twitter/typeahead.js

This seems to be happening in the async function within update:

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.async && that.trigger("asyncReceived", query);
   }
}

The line rendered += suggestions.length; should be placed one line below, after that._append(query, suggestions.slice(0, that.limit - rendered));

This was happening in 0.11.1

Most helpful comment

All 4 comments

yep, the above fixed a problem I was having too! good work.

I came here to point out the same mistake. Took me an hour to find it!

Looks like a pretty grave bug too. Maybe there are some missing tests?

Duplicate of #1232

Was this page helpful?
0 / 5 - 0 ratings