Skip to content

fix #1314 - limit doesn't work properly with more than one digit - #1319

Open
PierreAnctil wants to merge 1 commit into
twitter:masterfrom
PierreAnctil:#1314_limit_issue
Open

PierreAnctil wants to merge 1 commit into
twitter:masterfrom
PierreAnctil:#1314_limit_issue

Conversation

@PierreAnctil

Copy link
Copy Markdown

the suggestions where sliced with:
rendered += suggestions.length;
suggestions.slice(0, that.limit - rendered)

which is fine as long as limit < suggestions.length because slicing with a negative index works
but if limit = suggestions.length then no element is rendered.
if limit > suggestions.length then the results are truncated.

the suggestions where sliced with:
   rendered += suggestions.length;
   suggestions.slice(0, that.limit - rendered)

which is fine as long as  limit < suggestions.length  because slicing with a negative index works
but if limit = suggestions.length then no element is rendered.
if limit > suggestions.length then the results are truncated.
@ksykulev

Copy link
Copy Markdown

I just ran into the same issue. If limit == suggestions it shows no results.
suggestions.slice(0, 0) -> [] :(

@dougaxe1 dougaxe1 mentioned this pull request Jul 31, 2015
elemoine added a commit to Geoportail-Luxembourg/geoportailv3 that referenced this pull request Aug 18, 2015
This sets an arbitrary large limit (50) on the "pois" dataset to work around twitter/typeahead.js#1319.
elemoine added a commit to Geoportail-Luxembourg/geoportailv3 that referenced this pull request Aug 18, 2015
This sets an arbitrary large limit (50) on the "pois" dataset to work around twitter/typeahead.js#1319.
elemoine added a commit to Geoportail-Luxembourg/geoportailv3 that referenced this pull request Sep 2, 2015
elemoine added a commit to Geoportail-Luxembourg/geoportailv3 that referenced this pull request Sep 3, 2015
@core-system-dev

Copy link
Copy Markdown

@PierreAnctil Could you please re-submit this PR to github:corejavascript/typeahead.js. This project pretty much has been abandoned, and we continue now on a new fork. For more information please see #1320

@jlbooker

jlbooker commented Oct 5, 2015

Copy link
Copy Markdown
Contributor

Looks like a duplicate of #1212, has been fixed over at corejavascript/typeahead.js#8

scips added a commit to RTBF/typeahead.js that referenced this pull request Jan 6, 2017
scips added a commit to RTBF/typeahead.js that referenced this pull request Jan 6, 2017
* fix suggestion length bug see: twitter#1319
@CLAassistant

CLAassistant commented Jul 18, 2019 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants