bug: Offset paging can skip an item when another is removed between "Load more" requests
Back to our planType
bug
Problem
The incremental lists added in #111 (/events upcoming and past, /posts) page by offset (page × limit). Measured on a seeded copy, if an item that a visitor already has on screen is removed while they're reading, their next "Load more" misses one other still-published item; it shows again on reload. Removed means unpublished, deleted, or for events moved to a later date, or an upcoming event becoming past at midnight. Publishing a new item between loads skips nothing; the client also drops repeated ids.
It's transient and per visitor, so it was deferred from #111 to keep that PR narrow. The external review (2026-10-19) asked for this between-loads case to be tested. Its own issue (rather than an item inside the Phase 2 feature issue, #122) followed from the independent check of that response.
Proposed fix
Cursor (keyset) paging for the client loads: the cursor is the last item's sort key + id (date+id for events, publishedAt+id for posts), the query asks for items strictly after it, and both orders get id as an explicit tie-break. The no-JavaScript /events/list/<scope>/<n> and /posts/page/<n> pages can stay numbered.
Acceptance criteria
- Not done: Automated test, with ≥ 20 upcoming, ≥ 20 past events and ≥ 20 posts: publishing, unpublishing, deleting or re-dating an item between loads neither skips nor repeats any other item, in both lists and for posts.
- Not done: Same-date items crossing a page boundary still appear exactly once (already true today: tested on #111).
- Not done: The server actions validate the cursor strictly (type, format, length).
Area
frontend, cms
Priority
priority: medium
Generated by Claude Code, opens in a new tab