You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Click on the input again and see, that list prop changed, but suggestions does not
What is the expected behavior?
suggestions should change accordingly to list, as if it was computed property of list
Please tell us about your environment:
Vue.js Version: 2.6.11
Vue-simple-suggest version: 1.10.1
Browser: Firefox, Chrome, most likely all
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
To fix it we can watch list prop and do research() in the watcher.
But list prop also can be a function, and in such case, we can't watch it:
You can use clearSuggestions() method to get rid of previous suggestions when you are updating your list. I believe its easier than using watchers which i personally don't like using. So your code (the first one) looks like this:
Component declaration (adding ref) -- <vue-simple-suggest v-model="chosen" :min-length="0" :list="list" :ref="'suggestion'"> <!-- Filter by input text to only show the matching results --> </vue-simple-suggest>
updateList function (using ref to call clearSuggestions)-- updateList() { this.$refs.suggestion.clearSuggestions(); this.list = [ 'One', 'Two', 'Three', ] }
Thank you for proposing workaround, but I think that clearSuggestions will not work perfectly
in my production code, list is a computed property, so I do not really call a method to update it
clearSuggestions only help to refresh suggestions on open. But if dropdown is already opened and update happens at this time, clearSuggestions will lead to empty open list
I'm submitting a ...
What is the current behavior?
Updating
list
prop doesn't affectsuggestions
until input value changeIf the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
https://jsfiddle.net/pq38tusw/1/
list
prop changed, butsuggestions
does notWhat is the expected behavior?
suggestions
should change accordingly tolist
, as if it was computed property oflist
Please tell us about your environment:
To fix it we can watch
list
prop and doresearch()
in the watcher.But
list
prop also can be a function, and in such case, we can't watch it:https://jsfiddle.net/pq38tusw/2/
I propose to throw on non-async functions and guide users to use Array instead of a non-async function so they will not be caught by such bug.
The text was updated successfully, but these errors were encountered: