Search input focus resets pagination

I’ve set up a search that is basically a combination of the React Router 4 example and the Autosuggest example. I’m now seeing an issue where, if you change the page of results and then focus the search input, the page is reset to page 1. Basically, onSearchStateChange runs on focus and somehow resets the page. Any ideas what I can do to avoid that? Thanks!

Hi @kris ,

We reset the pagination to the first page every time a facet is added to the search or a new query is performed. As the result are changing, it’s better to go straight to the first page.

I believe that when you focus your input a new query is performed, can you confirm?

Is not performing a search on focus is something doable? If you’re still stuck can you provide a code sample and explain your use case?

Here is a template using code sandebox: https://codesandbox.io/embed/github/algolia/react-instantsearch/tree/master/packages/react-instantsearch/examples/react-router

I believe that when you focus your input a new query is performed, can you confirm?

The network inspector doesn’t show any requests being sent to Algolia when the input is focused. But thanks to the sandbox you linked I realised that the problem wasn’t with the searchState, but with this line in the react-autosuggest setup since refine runs on every input focus. I will continue investigating if I can make it work the way I want to :slight_smile: Thanks for your help.