Custom Refinement list makes 3 identical queries each time a refinement is applied/unapplied

Hello!

I have a custom refinement list using the connector from react-instantsearch. The refinement list currently makes 3 calls to the backend each time a refinement is applied/unapplied which has been eating up our call quota. I was hoping that someone could take a look and help out?

Hello,

It seems that you are rewriting the URL at each change in the searchState, triggering the same search multiple times.

You may want to only rewrite the URL when needed to avoid these additional searches.

Here’s an example on how you can achieve this with React Router (you are using Reach Router but the solution should be similar): https://github.com/algolia/react-instantsearch/tree/master/examples/react-router

1 Like