Refresh wipes out current search
Describe the bug 🐛
When even I use refresh on my <InstantSearch> component, the whole search resets. I'd hope that the current search page and refinements are kept but everything resets
To Reproduce 🔍
Currently I have the refresh value in the useState hook value and when I update something in algolia I wait for the operation to finish and then use this function to trigger the refresh
const pushRefresh = () => { setRefresh(true); setTimeout(() => { setRefresh(false); }, 1000); };
Expected behavior 💭
That the search keeps the current page and refinement parameters
Environment:
Using Next.js
Can you create what you have so far in a sandbox environment? We have a template available for that purpose here. Thanks!
Hi @Haroenv thanks for the follow up and thank you for the sandbox link, I was able to start narrowing my use case using the sandbox. It seems that what is making this behavior is my custom connectPagination component. I have created a custom update to the sandbox you gave me with just that component as an extra addition and it is giving me the same result as in my site.
Here is the link https://codesandbox.io/s/dreamy-chaum-kpers?file=/src/App.js
Here are the steps on how to replicate:
- change a page in the pagination at the bottom
- pick any refinement
- click the
Item Actionbutton [this button just has a promise but I normally do actions to the database here]
After this the search resets completely
In the meantime I will use the default pagination and just style it in my site. But I don't see anything I can notice about why this custom connector will make the whole search reset on refresh.
let me know if there is any other information you may need. Thank you very much.