react-instantsearch react-router-3 example calling onSearchStateChange on route change
See original GitHub issueDo you want to request a feature or report a bug?
bug
Bug: What is the current behavior?
When I use the code from the react-router 3 example whenever I try to navigate away from the page with the react-instantsearch component in it, onSearchStateChange
gets called 6x and it immediately pushes over the new route.
Bug: What is the expected behavior?
I don’t expect onSearchStateChange to be called if the route pathname changes, and I expect the component to be unmounted. I also don’t expect it to be called 6 times. I should be able to navigate away from this page without the onSearchStateChange
router push/replace overriding my new location
Bug: What browsers are impacted? Which versions?
I think this is an implementation/example error, not a browser error. But I experienced this on the newest Chrome build.
Feature: What is your use case for such a feature? DNA Feature: What is your proposed API entry? The new option to add? What is the behavior?
What project are you opening an issue for?
- react-instantsearch
What is the version you are using? Always use the latest one before opening a bug issue. 3.2.1
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Hi @davidfurlong,
If I understand correctly, what you want is a way to unmount widgets without having
onSearchStateChange
?Is https://github.com/algolia/instantsearch.js/issues/2061 describe your issue?
Same here - seems to happen during unmount. As a temporary fix you can set a flag in componentwillunmount and then ignore search state changes after that point.