algolia / instantsearch

⚑️ Libraries for building performant and instant search experiences with Algolia. Compatible with JavaScript, TypeScript, React and Vue.

Home Page:https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Autocomplete : getWidgetRenderState giving me initial null result

DonBenci opened this issue Β· comments

πŸ› Current behavior

When typing on the search bar, I'm getting an error in the console as soon as it returns a result. However I get a null result pass thru in the getWidgetRenderState function in the vue-instantsearch.js file.

attaching screenshots below of the error and the file.

Screenshot 2024-02-21 at 2 57 07 PM
Screenshot 2024-02-21 at 2 56 57 PM

This is the scopedResult object

Pasted Graphic 1
Pasted Graphic 2

as you can see, it's null. That is getting caught in my e2e.

πŸ’­ Expected behavior

to not get the error when typing

I'm wondering if the scopedResults should be filtered by results first, only the ones that's not null should be mapped.
I haven't tested this though.

something like this:

 var indices = scopedResults.filter((scopedResult)=>scopedResult.result != null).map(function(scopedResult) {
          scopedResult.results.hits = escapeHTML ? escapeHits(scopedResult.results.hits) : scopedResult.results.hits;
....

I'm new to the Algolia instasearch ui lib, I've been reading for the past 2 days, I might be missing something. if this is not a bug I hope someone could lead me to the right direction πŸ™

Package version

@nuxt/algolia@latest

Operating system

No response

Browser

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct