Closed tbl0605 closed 3 years ago
I forgot to mention that I can reproduce this bug (at least) on latest versions of Chrome and Firefox :)
The issue disappears with my patch (I cannot reproduce the bug anymore). But you should consider it as a partial fix or workaround, because there is a real deeper problem in your code (I haven't tracked it down), the value of "isPlainSuggestion" seems (sometimes) not to be in sync (or updated soon enough) to reflect latest values retrieved from method getSuggestions(). So my patch will "hide" the real problem but not completly fix it.
For example, before my patch, you could have :
Hope I'm clear enough :)
My guess for the real problem is that multiple calls to "await this.list(value))" can be done in a very short time and those promises can resolve in any order when the server api is a bit laggy. Probably getSuggestions() should return an object containing "isPlainSuggestion" and the list of suggestions, so that both would be synchronized and be updated at same time (and neither too early nor too late).
Hopefully last comment: I updated my patch so it can be taken as-is, without doing further code changes afterwards, even if I think that "isPlainSuggestion" should be updated outside of getSuggestions() at same time than this.$set(this, 'suggestions', newList)
Hello, @tbl0605 Thanks for the reporting and such a deep dig into the bug :)
@kaskar2008, would it be possible to make a new release now that this patch is merged? Thank you for you great work :)
Hi, I recently created an autocomplete component for city names using vue-simple-suggest. I'm using async data retrieval (https://github.com/KazanExpress/vue-simple-suggest#async-example) and debouncing. It works great, except that sometimes I have graphical glitches (see my screenshots). I first thought it was because of the way I'm retrieving the data (or because of axios), but I have same problem when I rewrite my code using the fetch() function.
Step to reproduce:
PS: you can also try the fetch() version, but the bug is harder to reproduce with it: https://codesandbox.io/s/bug-vue-simple-suggest-2-eyuk8