Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

minLength: 0 should be implemented

See original GitHub issue

Currently minLength: 0 behaves like minLength: 1. In some applications it is quite useful to be able to fetch and display all of the possibilities right away because the number is small enough or they are cleverly sorted by likelihood of relevance. This can eliminate the need to use a different component for an almost identical use case.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

prmichaelsencommented, Jan 10, 2019

Hi, @ericgio, thank you for your fast response. This may be the intended behavior, but it doesn’t seem correct. If the user can specify a minLength of 0 (which is valid according to the docs), then the onSearch should fire for empty queries.

Consider my use-case. I have a dataset of 1000+ entries. When the user has no query, we display a short list of likely relevant choices. This means if the user types a query, and then removes it, we would need to once again display the likely relevant choices.

ericgiocommented, Jan 12, 2019

there is no way to inform my data provider that there is no longer a query

Sure there is. You can use onInputChange to get the current input value. onSearch is just a debounced callback being passed to onInputChange anyway.

Note that AsyncTypeahead is just an HOC that adds some simple debouncing and a basic cache to the main Typeahead component. It’s provided with the library for convenience and to handle most simple async use cases. If it doesn’t meet your needs you can easily write your own HOC that handles things exactly as you’d like them to.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML attribute: minlength - HTML: HyperText Markup Language
The minlength attribute defines the minimum number of characters (as UTF-16 code units) the user ... This must be an integer value 0...
Read more >
Why doesn't input minlength check work with initial value?
This is by design. The minlength attribute only validates a field once it has been edited by the user. It doesn't validate the...
Read more >
How to Set a Minlength Validation in HTML5 - W3docs
In this snippet, find out what alternative attributes to minlength can be used to set a minlength validation in HTML5. Read our snippet...
Read more >
How to fix: Attribute “minlength” is only allowed when the input ...
This must be an integer value 0 or higher. If no minlength is specified, or an invalid value is specified, the input has...
Read more >
HTML input minlength Attribute - W3Schools
The minlength attribute specifies the minimum number of characters required in an input field. Note: The minlength attribute can be used with input...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found