Skip to content

[#207] Add pagination to home page story grid#216

Merged
realproject7 merged 2 commits intomainfrom
task/207-pagination
Mar 16, 2026
Merged

[#207] Add pagination to home page story grid#216
realproject7 merged 2 commits intomainfrom
task/207-pagination

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Fixes #207 — Prev/Next pagination, 24 per page, preserves filters.

- PAGE_SIZE = 24, uses supabase .range() for offset pagination
- Prev/Next buttons with page number, preserves tab + writer params
- Works with all sort options and writer filter
- Trending/rising use PAGE_SIZE instead of hardcoded 20

Fixes #207

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES

Summary

The pagination wiring works for the direct Supabase queries, but it is incomplete for the trending and rising sorts. Those paths still ignore the requested page offset, so navigating to later pages repeats the first-page results instead of advancing the grid.

Findings

  • [high] trending and rising pagination repeat page 1 because the page offset is never applied.
    • File: src/app/page.tsx:171
    • Suggestion: Thread the page offset through the ranking helpers or slice the ranked results after fetching enough items, so ?tab=trending&page=2 and ?tab=rising&page=2 do not return the same first 24 stories as page 1.

Decision

Requesting changes because pagination must work consistently across all sort modes, and the current implementation only paginates new and completed.

Add offset param to getTrendingStorylines and getRisingStorylines.
Page 2+ now correctly advances results for all sort options.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

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

Verdict: APPROVE

Summary

The follow-up commit fixes the pagination bug I flagged by threading an explicit offset through getTrendingStorylines and getRisingStorylines, and the home page now passes the correct offset based on the requested page. That makes page 2+ advance correctly across all sort modes instead of repeating page 1 for ranked tabs.

Findings

  • [info] Previous blocking finding resolved.
    • File: src/app/page.tsx:171
    • Suggestion: None.

Decision

Approving because pagination now behaves consistently for new, completed, trending, and rising, GitHub lint-and-typecheck is passing, and local typecheck is clean.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

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

T2b APPROVE

Well-implemented pagination:

  1. Server-side — Supabase .range(from, to) for new/completed tabs, offset param added to ranking helpers for trending/rising. All 4 tabs paginate correctly.
  2. Client-side — Prev/Next links preserve tab + writer params via buildPageHref. Page number parsed with Math.max(1, ...) guard. "Next" only shows when results === PAGE_SIZE.
  3. PAGE_SIZE = 24 — Good for 3-col grid (divisible by 3).

No issues.

@realproject7 realproject7 merged commit 854909f into main Mar 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UX] Home page: add pagination or infinite scroll for story grid

2 participants