connectStateResults is being called more than one time

react-instantsearch

#1

Hello,

I’ve been using connectStateResults for a while, and recently noticed that it was being called 3 or 4 times in a row with the same arguments, anytime I enter a new search. This is obviously a problem since the UI is getting rendered too many times.

my application uses a controlled Instantsearch (using resultsState, searchState, and
onSearchStateChange props), as well as a custom Hits component with connectHits.

However, I could reproduce this issue by using Algolia default Hits component, and by switching to InstantSearch to an ‘uncontrolled’ mode (by removing the use of resultsState, searchState, and
onSearchStateChange props).

Are you aware of this kind of issue, and are there any fixes?

I can provide you with a test case if needed


#2

The connector renderer is expected to be rendered at least twice when loading (1) and then loaded (2). It can render another time when the search is considered as stalled (3).

A reproduction would be helpful to see if everything is working as expected. We provide this React InstantSearch template to help you reproduce the behavior.