Closed twbagustin closed 5 years ago
Ignore the debugger; line there! And the problem is that selected() is triggered with an empty suggestion because there is no suggestion selected actually! Ohh and p.s Darren, nice to meet you first, I would be happy to help with small fixes here and there (as a freelancer I work more than the day job leaves little time to contribute), I think that for doing so, some docstrings here and there in the methods to understand what X is meant to do, would help a lot!
It is possible to have an index of -1, since we decrement +/-1 when user is keying through results. -1
is therefore able to tell the library that a user has keyed themselves into the input
.
Would welcome PR's for sure, if you have better reproduction link+steps, we can better identify as I cannot reproduce your issue.
I like your idea for better code level docs, and so have created this ticket to do so: #150
Closing due to inactivity. If you can provide more detailed steps then I can look again.
Looks like this came up again in #153 so will re-open to address. I think I see the issue now
vue-autosuggest
version: 2.0.4node
version: -npm
(oryarn
) version: -Relevant code or config
What you did: Playing with the lib
What happened:
Reproduction repository: https://codesandbox.io/s/vueautosuggest-api-fetching-57d4e
Problem description:
Suggested solution: I see in the code that you do
this.currentIndex == -1
, line 302, I don't know when and how the currentIndex can go below 0, but eitherif (this.totalResults > 0 && this.currentIndex !==null)
if it can't go below 0 otherwiseif (this.totalResults > 0 && this.currentIndex !==null && this.currentIndex >= 0)