algolia / instantsearch

⚑️ Libraries for building performant and instant search experiences with Algolia. Compatible with JavaScript, TypeScript, React and Vue.

Home Page:https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`useHits()` loose its page state in nextjs app router

duncanbla974 opened this issue Β· comments

πŸ› Current behavior

If you navigate to a page > 0 then click on a product and want to go back to the listing page with the navigator back button, it looks like useHits loose the page state and show wrong products. While uiState page or usePagination currentRefinement are correct.

πŸ” Steps to reproduce

  1. Add a search query manually to the url (example: /search?instant_search%5Bquery%5D=le )
  2. Navigate with the pagination to go on another page ( page 2, page 3, ...)
  3. Click on a product
  4. When in product page, click on the navigator back button

Live reproduction

https://codesandbox.io/p/devbox/angry-rgb-7vdcfk

πŸ’­ Expected behavior

I expect the products on the listing page to be the same than before navigating to a product.

Package version

nextjs 14.1.0,

Operating system

Windows

Browser

Chrome

Code of Conduct

  • I agree to follow this project's Code of Conduct