-
Notifications
You must be signed in to change notification settings - Fork 74
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
Search is performed on initial load without any interaction (since upgrading from 1.9.5 to 1.10.1) #220
Comments
From what I can tell it stems from the watcher on
It then goes through: Line:166 As i'm reading it, it looks like every time the value of the input is changed then it performs a new search and there's no way around this. But it seems perfectly valid to change the display text (or to change the value if you're using an object or something) without performing a search. Surely a search should only be performed when some sort of interaction occurs. Here is a JS Fiddle: https://jsfiddle.net/5awsth47/ If you click the "Set value React" or "Set value Vue" buttons to set the value of the input a search will be performed ("Called Suggestion List" is logged to the console). I made a fake promise to replicate an API call, I think its sufficient to demonstrate the behaviour. |
So nearly 4 years later I finally fixed this bug for myself with a rather hacky extend of the original. Basically you want to add this to
Annoyingly this then leads an API call being made as soon as you click or focus on the input. To get around this you want to extend the Here's a full component that extends the original:
It's a horrible hack but it looks like this package is abandoned so it'll do for now. |
I'm submitting a ...
What is the current behavior?
I have a table with 30 rows which has a vue-simple-suggest input in one column of each row (so 30 instances). The contents of the input is preloaded and the request is assigned to
:list
and@select
is used to fetch new selections.This has only started occuring since upgrading from 1.9.5 to 1.10.1
When the table renders
getResults()
is called 30 times once for each component. Without any interaction with the page.If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
This is my exact component, its just a wrapper really that emits its own
select
event which is handled elsewhere and doesn't seem to make a difference.What is the expected behavior?
getResults()
should only be called when there is some sort of interaction with the component.How are you importing Vue-simple-suggest?
import VueSimpleSuggest from 'vue-simple-suggest'
)Please tell us about your environment:
The text was updated successfully, but these errors were encountered: