Rerendering and connectRefinementList

Hi, I have a question regarding the connectRefinementList from react-instantsearch-dom.

The issue I’ve come across is that when using searchForItems, all components that are wrapped with connectRefinmentList are rerendering. I also found that in the ecommerce example (E-commerce demo | Algolia) all components that are hooked up to algolia are rerenderingen when searching in BRANDS.

In our case, this has been causing some trouble since we have one custom built refinement that is pretty heavy to rerender. So the questions is basically, is this behaviour something that is intended and if yes, why so? And is there also a way around it, to make connectRefinmentList only rerender after another filter has been refined :slight_smile:

Hi! I had a look at the demo and the code of connectRefinementList and indeed, it seems that there are no memoization mecanism in place. I think the assumption is that if you need one it’s possible to implement it in your transform.

Could you maybe implement a memoization layer in your code to not recompute your heavy refinement when values are identical to a previous run?

Hi! Thanks for the answer! Interesting.

1 Like