Improve front-end pagination of the Discussion List
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Issue created from flarum/framework#1829 and flarum/framework#1820 (pts 2 & 4). flarum/framework#1820 in particular has a lot of useful discussion.
Problems:
- Pagination currrently breaks with a query `?page=` parameter
- Users are unable to load previous pages
- Refreshing the page will bring the user back to the page they started at
- Can update query page parameter on load button press & scroll
Solutions:
- Adapt the code from flarum/framework#1829
- Create a Pagination JS util and use it in DiscussionList
- An example of this can be found @ https://github.com/flarum/core/commit/f6d88bf724f4ed8c2a2f2bf12c0b19563ad6432f - this code is bad and should only be used as example & inspiration
---
Comments from the PR
> Too much SEO voodoo that I'd like to investigate and read up upon first, after seeing flarum/framework#1820 and https://webmasters.googleblog.com/2014/02/infinite-scroll-search-friendly.html.
> \- Franz https://github.com/flarum/core/pull/1829#issuecomment-529813635
> Now that I've seen it, I am unsure this approach makes sense without a scroll handler. When you click multiple times on "Load previous" and "Load more", which page are you expected to be "on" (reflected by the URL parameter)? I am kind of thinking it would always be the earliest one that's loaded - because the top of the page would remain the same once you refresh the page. This would mean only "Load previous" would change the URL state.
> I think we can use the links from API responses instead of building URLs ourselves - that should simplify the state on the client.
> \- Franz https://github.com/flarum/core/pull/1829#issuecomment-601662905
> For consistency with scrolling inside a discussion, the page parameter in the URL should update whenever moving up or down.
Refreshing shows (roughly) the same section (i.e. page) that you were looking at before the refresh.
> \- Franz https://github.com/flarum/core/pull/1829#issuecomment-612223355
Contributor guide
Assessment
This issue has not been assessed yet.