lukeraymonddowning / infinite_scrolling_in_inertia_js

3 stars 6 forks source link

Clicking the browser back button to go back to an infinite scroll list should preserve the scroll position #4

Open connecteev opened 1 year ago

connecteev commented 1 year ago

Per the thread here: https://laracasts.com/series/infinite-scrolling-in-inertia/episodes/4?reply=23931

When you:

  1. Go to a page with infinite scroll functionality, like http://laracasts_luke_downing_infinite_scrolling_inertia.test/videos
  2. Scroll down to load more "pages"
  3. Click a link (ex: say if each list item is a link), which takes you to a different page, like /test
  4. Press the browser back button
  5. You are taken to http://laracasts_luke_downing_infinite_scrolling_inertia.test/videos?page=9 and only the contents of page 9 are loaded.
  6. Instead, the URL should be http://laracasts_luke_downing_infinite_scrolling_inertia.test/videos, the content of pages 1-9 should be loaded, and the scroll position should be preserved to that of page=9

Note: This is different from the 'back button' problem mentioned here: https://github.com/lukeraymonddowning/infinite_scrolling_in_inertia_js/issues/3

This reply has more context / detail: https://laracasts.com/series/infinite-scrolling-in-inertia/episodes/4?reply=23965