Add server-side pagination to recommendations view #13

Closed
opened 2026-07-10 09:24:08 +00:00 by coding-agent-marvin8 · 1 comment
coding-agent-marvin8 commented 2026-07-10 09:24:08 +00:00 (Migrated from codeberg.org)

The recommendations view currently fetches only the first page of results (Trakt API default: 10 items). Power users with large recommendation queues cannot access items beyond the first page.

Fix: pass ?page=N&limit=N to the Trakt recommendations endpoint. A DOWN-arrow keypress on the existing ... sentinel row replaces the current table with the next page.

The recommendations view currently fetches only the first page of results (Trakt API default: 10 items). Power users with large recommendation queues cannot access items beyond the first page. Fix: pass `?page=N&limit=N` to the Trakt recommendations endpoint. A DOWN-arrow keypress on the existing `...` sentinel row replaces the current table with the next page.
coding-agent-marvin8 commented 2026-07-10 09:24:22 +00:00 (Migrated from codeberg.org)

Findings: get_recommendations in api_actions.py currently fetches a single page (no pagination params). Trakt returns pagination headers (X-Pagination-Page, X-Pagination-Page-Count). The TUI already has a __more__ sentinel row in _populate_items_table but no keybinding wires it up.

Plan:

  1. Add RecommendationsPage(items, has_more) NamedTuple and limit param to TraktApi. Update get_recommendations to pass ?page=N&limit=N, parse response headers for has_more.
  2. Add recommendation_page, _is_paginated_view, _on_more_sentinel to RecommendApp. Add on_key handler: DOWN on sentinel + paginated view → increment page, reload. Unrated-watched views set _is_paginated_view=False so their sentinel remains inert.

Both tasks are TDD — failing tests written first.

**Findings:** `get_recommendations` in `api_actions.py` currently fetches a single page (no pagination params). Trakt returns pagination headers (`X-Pagination-Page`, `X-Pagination-Page-Count`). The TUI already has a `__more__` sentinel row in `_populate_items_table` but no keybinding wires it up. **Plan:** 1. Add `RecommendationsPage(items, has_more)` NamedTuple and `limit` param to `TraktApi`. Update `get_recommendations` to pass `?page=N&limit=N`, parse response headers for `has_more`. 2. Add `recommendation_page`, `_is_paginated_view`, `_on_more_sentinel` to `RecommendApp`. Add `on_key` handler: DOWN on sentinel + paginated view → increment page, reload. Unrated-watched views set `_is_paginated_view=False` so their sentinel remains inert. Both tasks are TDD — failing tests written first.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
marvin8/kokopelli#13
No description provided.