algolia / instantsearch

⚡️ Libraries for building performant and instant search and recommend experiences with Algolia. Compatible with JavaScript, TypeScript, React and Vue.
https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/
MIT License
3.59k stars 503 forks source link

infinite hits (vue-instantsearch): isLastPage has wrong value after loading previous items #6213

Open oliverbeck-dev opened 1 month ago

oliverbeck-dev commented 1 month ago

🐛 Current behavior

I use infiniteHits with show-previous=true. if hit "load more", the next 30 items get loaded and the url has &page=2. overall there are around 100 items and per page I set 30. If I then reload the page, It shows all items correctly. I see all items from page 2. at the bottom I still see the button "load more" and at the top I see a button "load previous". If I click "load more", it loads the previous 30 items correctly, but the "load more" button disappears. that shouldn't happen since there are around 35 pages

🔍 Steps to reproduce

  1. use infiniteHits with more than 2 pages
  2. activate showPrevious
  3. load the second page
  4. reload the page
  5. load the previous ones
  6. you should still see the load more button but you probably won't

sorry for not providing a codesandbox live example, but the vue instantsearch templates seems broken, I can't start a working environment with that

Live reproduction

https://codesandbox.io

💭 Expected behavior

with the infiniteHits widget I would expect, that when I have more that 2 pages and load the page with ?page=2 argument and then load the previous ones (from page 1), I should still see the button "load more"

Package version

instantsearch.js 4.69, vue-instantsearch 4.17

Operating system

No response

Browser

No response

Code of Conduct