I trying to get React Instantsearch’s URL routing to work with the browser’s “back” & “forward” buttons.
The problem is that the official example doesn’t handle this. (I coded it on my own and got it “working”, but then had an issue with 2x requests being made to Algolia each time a search was made. So I’m starting with official example again, but it doesn’t support browser’s “back” and “forward” buttons.)
- URL routing working (this works)
- Debounced search (this works)
- Browser’s back & forward buttons should update the search input’s value & results (does not work) << PROBLEM
- Type “Samsung”
- Type “Apple”
- Click “back” button.
Expected result: to see “Apple” in the search input and Apple results.
Actual results: “Samsung” remains in the search input & Samsung results remain shown.
How can I get the search input’s value & results to update when the browser’s “back” & “forward” buttons are pressed?
(My example is based of these Algolia examples: