I’ve got routing set up so that refinement lists, hierarchical menus, query, and pagination works nicely. Back and forward algolia saves the states and steps through them perfectly showing the related search results for those states.
I’d like to add aroundlatlng to routing so that when sort by distance is checked the results save to state and properly update while going back and forward in history. Adding latitude and longitude to routing works fine for the url history but the search results don’t update…predictably.
Pressing back on the browser with default settings will step through the history state of the search query, refinement lists etc and the results that go with them. Pretty much anything under the uiState object reference works great. But I see no reference or way to control aroundlatlng between history states there:
Seemingly the simplest solution is to run search.helper.setQueryParameter(‘aroundLatLng’, urlLatLng).search() when onpopstate or algolia’s routeToState is run but this causes the history to break. Forward button disappears and causes the back button to need double clicked to get to previous results.
I’ve tried some other things but before I write a book maybe there’s a proper solution?