Skip to content

Move the front page to cursor based pagination#1985

Open
BentiGorlich wants to merge 9 commits intomainfrom
new/front-cursor-pagination
Open

Move the front page to cursor based pagination#1985
BentiGorlich wants to merge 9 commits intomainfrom
new/front-cursor-pagination

Conversation

@BentiGorlich
Copy link
Member

@BentiGorlich BentiGorlich commented Jan 31, 2026

  • instead of the usual LIMIT/OFFSET pagination use cursor based one based on the current ordering
  • Write classes that are inspired by the pagination of doctrine for cursor based pagination
  • make the ContentRepository work with the new pagination, while still working with the regular one

Left ToDos:

  • API
  • Infinite Scroll support
  • RSS

Fixes #1869

@BentiGorlich BentiGorlich self-assigned this Jan 31, 2026
@BentiGorlich BentiGorlich added backend Backend related issues and pull requests performance This is a issue regarding performance. labels Jan 31, 2026
@BentiGorlich BentiGorlich modified the milestone: v1.10.0 Feb 4, 2026
@BentiGorlich BentiGorlich force-pushed the new/front-cursor-pagination branch from 1069a55 to fe09af6 Compare February 4, 2026 14:44
@BentiGorlich BentiGorlich marked this pull request as ready for review February 10, 2026 09:50
@BentiGorlich BentiGorlich force-pushed the new/front-cursor-pagination branch from 02e5a72 to d147ba7 Compare February 16, 2026 14:36
@BentiGorlich BentiGorlich force-pushed the new/front-cursor-pagination branch from d147ba7 to 5d48db3 Compare February 24, 2026 13:37
{
$initialCursor = $contentRepository->guessInitialCursor($criteria);
if ($initialCursor instanceof \DateTime || $initialCursor instanceof \DateTimeImmutable) {
$currentCursor = null !== $cursor ? new \DateTimeImmutable($cursor) : $initialCursor;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errors from converting the supplied cursor should be caught and wrapped in a bad-request exception with a meaningful message
(same for line 537)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So do you mean the LogicException, or the DateMalformedStringException? Or just a general try catch around the method call?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DateMalformedStringException (and whatever else can occur from the date / int -conversation). It should result for the user in a 400 http response which also explicitly indicates that the cursor param was invalid.

The LogicException sounds more like a 500 error.

@blued-gear
Copy link
Collaborator

Regarding the design of the forward and back button: IMO it would look better if at the bottom (and maybe also on the top) there would be two buttons with an arrow to the left / right (spread so that they are on the opposite ends of the container).
Maybe also a button to go to page 1, as currently the user needs to click on the magazine name to go there, which removes the current sorting.

- instead of the usual `LIMIT`/`OFFSET` pagination use cursor based one based on the current ordering
- Write classes that are inspired by the pagination of doctrine for cursor based pagination
- make the `ContentRepository` work with the new pagination, while still working with the regular one
- add API endpoint to retrieve content using the cursor pagination
- add tests for the `CombinedRetrieveApi`
- make `CombinedRetrieveApi` actually returning combined content
…est cases

- remove some unnecessary stuff from the `EntryFrontController`
- Add test case for the `cursorUserCollection` endpoint in the `CombinedRetrieveApi`
- assert the item counts in the pagination test
@BentiGorlich BentiGorlich force-pushed the new/front-cursor-pagination branch from 5d48db3 to d87b945 Compare March 3, 2026 10:01
@BentiGorlich
Copy link
Member Author

Regarding design: could you make a quick sketch, so I can see what you mean exactly?

@BentiGorlich BentiGorlich requested a review from blued-gear March 3, 2026 12:54
@blued-gear
Copy link
Collaborator

blued-gear commented Mar 3, 2026

Regarding design: could you make a quick sketch, so I can see what you mean exactly?

here you go
example
(it might be even better, if the buttons with the arrows would not be solid colored)

@BentiGorlich
Copy link
Member Author

Hmm ok... My though process was: "if I am at the bottom of a page, I will most likely want to go to the next page. If I am at the top then the previous page".
I can see why you'd want to be able to go to the first page if you're at the top, but it does not make sense to me to have all 3 buttons in both places

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend related issues and pull requests performance This is a issue regarding performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Peformance: Threads (+ Microblog) frontpage query

2 participants