Closed JohnDotOwl closed 2 years ago
We are experiencing the same issue. Did you manage to find a solution?
Facing the same issue in my app too. Any solution you guys managed to find?
I am facing the same issue.
See movie here:
https://user-images.githubusercontent.com/1014016/175003982-69a8ca22-28ed-464e-a9c0-1b317394de32.mov
It happens even if I use the most basic setup (Vue3, no AlpineJS, no TailwindCSS, no jQuery, etc.):
<template>
<AisInstantSearch
:index-name="indexName"
:search-client="searchClient"
>
<AisSearchBox />
</AisInstantSearch>
</template>
But I have to say that I use a typesense search adapter and the response to the server takes around 200ms. When I type a new letter, the letter stays for this 200ms. When the response from typesense is back, in that short moment when the Vue model is updating, the letter is removed and added again.
When I use exactly the same DebouncedSearchBox component from here https://codesandbox.io/s/ms-vue3-is-0293zk?file=/src/App.vue:900-927 with a 10ms delay, then the flickering is gone.
<AisInstantSearch :index-name="indexName" :search-client="searchClient">
<DebouncedSearchBox delay="10" />
</AisInstantSearch>
In my opinion, there is some problem in the $emit here https://github.com/algolia/vue-instantsearch/blob/master/src/components/SearchInput.vue#L27 or with the modelValue here https://github.com/algolia/vue-instantsearch/blob/master/src/components/SearchBox.vue#L156
But its just a best guess.
Please fix it.
Update: I don't think it has something to do with debouncing as mentioned here https://www.algolia.com/doc/ui-libraries/autocomplete/integrations/with-vue-instantsearch/#debouncing-search-results
It happens as well when typing very slowly:
https://user-images.githubusercontent.com/1014016/175019096-a1255417-2e4c-49f2-a251-611b9cfa288f.mov
And as written before, it also happens on a plain site with the default vue-instantsearch components and without Tailwind or Alpine or anything else. Unfortunately I can't test it without a typesense server.
I think the component is re-rendered unnecessary when the model value is updated.
Thanks a lot. Your fix works for me.
https://user-images.githubusercontent.com/3077812/167888542-4d17f477-961d-4870-a37d-a11c6c4eae04.mov
When i try to type fast, it would automatically snapback and cancel my typing and replace the text with what the server respond with. I'm not sure where to look into as my configuration are almost identical to the demo located here https://codesandbox.io/s/ms-vue-is-1d6bi?fontsize=14&hidenavigation=1&theme=dark&file=/src/App.vue
I don't have other JS files, so i don't think it's conflicting with others. I've tried disabling my alphine.js which i use for tailwind ui stack but still face the same issue.
sorry to post this here but the issue seems to be appearing depending on which vue-instantsearch version i set , at this moment certain version doesn't give issue on codesandbox but i can't seem to get it to work properly when i compile it on my laravel even with cache cleared and all. Any idea where i should look into to solve this issue ?
app.js
package.json
You can test it here too https://codesandbox.io/s/ms-vue3-is-0293zk?file=/src/App.vue (vue 3)