I am working on an vue app that
a) needs to parse the search query for keywords (city names, for ex. a query like “chinese food in London”) and then updates :around-lat-lng based on that.
b) Alternatively asynchronously gets the user’s position from the browser API and then sets :around-lat-lng.
My issue is that this generates more queries than there should be, which leads to flashing/changing of the results, performance issues as well as concurrency issues(I think - I’m getting some weird behaviors that I assume comes from multiple queries running asynchronously almost at the same time)
My question is how to best approach this:
a) parsing the query and updating position, then querying the Algolia API just one time. I’m not sure how to best intercept the query as it is being entered and also apply the same parsing logic for queries coming in from the URL via the routing/parseURL(). Currently I’m thinking I might need to roll my own modified ais-search-box. But unsure how to solve it for queries via parseURL().
b) again, when getting the position from the browser API, how to hold the query from being sent until that is done.
I’m using vue-instantsearch beta3 with custom routing and state mapping, a few facet filters and an ais-search-box.