-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react-router example issuing multiple queries per search #1834
Comments
Hi @dzello thanks for reporting this :) One thing you can already do is adding the But there's still one other request made and I still don't know why. I'll will investigate more and update the example when found. |
So in the end there is two things going on here:
shouldComponentUpdate(nextProps, nextState) {
return !isEqual(this.state.searchState, nextState.searchState);
}
You can follow the different fixes in this PR #1840. |
Thanks for the speedy reply @mthuret, I'll follow along over there. 💯 |
I'm closing this since it should be ok with the 2.2.0 of RIS :) |
Do you want to request a feature or report a bug?
Bug in the react-router example
Bug: What is the current behavior?
In the react-router example, 3 queries are sent to Algolia for each refinement of the search.
Bug: What is the expected behavior?
1 query is sent to Algolia for each refinement.
Bug: What browsers are impacted? Which versions?
All.
To reproduce, load the react-router example inside of this repository and watch the network tab as you add one letter to the search box. You should see 3 calls to Algolia where only 1 is expected. The first search happens as expected from
<SearchBox/>
widget, the second and third searches happen because the<App/>
component re-renders as a result of prop and state changes, from the location change andonSearchStateChange
. I believe React-InstantSearch is behaving as expected, to re-trigger the search on each render, but I wasn't able to find a good way to implementshouldComponentUpdate
that prevents additional renders but still allows child components to update with the new search state. Thoughts?What project are you opening an issue for?
What is the version you are using? Always use the latest one before opening a bug issue.
Latest:
486f005
The text was updated successfully, but these errors were encountered: