Skip to content

[#67] Fix reader dashboard missing pagination#69

Merged
realproject7 merged 2 commits intomainfrom
task/67-reader-pagination
Mar 14, 2026
Merged

[#67] Fix reader dashboard missing pagination#69
realproject7 merged 2 commits intomainfrom
task/67-reader-pagination

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Add .range() pagination (50 per page) with Supabase count: "exact" for accurate total count without fetching all rows
  • Add prev/next page controls when more than one page exists
  • Total $PLOT display scoped to current page to avoid inaccurate server-side sums

Fixes #67

Test plan

  • Verify donation list loads with ≤50 rows per page
  • Verify page controls appear when >50 donations exist
  • Verify total count header reflects all donations (not just current page)
  • npm run lint and npm run typecheck pass

🤖 Generated with Claude Code

Fixes #67

- Add .range() pagination with PAGE_SIZE=50 and Supabase count:"exact"
  for accurate total count without fetching all rows
- Add prev/next page controls when more than one page exists
- Total $PLOT display scoped to current page to avoid inaccurate sums

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.

LGTM. Pagination logic is clean — .range() with count: "exact" is the correct Supabase pattern, query key includes page for proper cache isolation, and button disabled states are correct.

One minor edge case to consider for a follow-up: if the user switches wallets while on page > 0, page state doesn't reset to 0. This could briefly show an empty page (e.g. "Page 4 of 1") until the user clicks Prev. A useEffect that resets page to 0 when address changes would fix this. Not blocking since it's an uncommon interaction and the original bug (no pagination at all) is properly fixed.

Approved.

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 change addresses the unbounded query and CI is green, but it leaves the dashboard in an invalid page state when the connected wallet changes.

Findings

  • [medium] Pagination state is never reset or clamped when address changes, so switching from a wallet on page N to a wallet with fewer pages can fetch an out-of-range slice and render a false empty state. Example: wallet A on page 3 -> switch to wallet B with 12 donations -> query runs for rows 150-199, totalCount is 12, the UI shows "12 donations" and "No donations yet", and the pager disappears because totalPages becomes 1.
    • File: src/app/dashboard/reader/page.tsx:36
    • Suggestion: Reset page to 0 whenever the connected address changes, or clamp page after each fetch when page >= totalPages.

Decision

Requesting changes because this produces incorrect reader-dashboard results for a normal wallet-switch flow.

Prevents stale page index from showing false empty state when switching
to a wallet with fewer donations.

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.

LGTM. The useEffect page reset on address change properly addresses the wallet-switch edge case. Clean fix. Approved.

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 pagination fix now addresses the original unbounded donation query and also correctly resets pagination when the connected wallet changes. The updated PR matches issue #67 and the lint-and-typecheck check is passing.

Findings

  • none

Decision

Approving because the reader dashboard now paginates the donation query safely, provides navigation, and avoids the false empty-state regression from wallet switching.

@realproject7 realproject7 merged commit d611ac3 into main Mar 14, 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.

[BUG] Reader dashboard missing pagination on donation query

2 participants