Skip to content

fix(web): paginate approvals page so 100 cards don't render at once#84

Merged
jayzalowitz merged 1 commit into
mainfrom
jayzalowitz/approvals-pagination
Apr 26, 2026
Merged

fix(web): paginate approvals page so 100 cards don't render at once#84
jayzalowitz merged 1 commit into
mainfrom
jayzalowitz/approvals-pagination

Conversation

@jayzalowitz

Copy link
Copy Markdown
Owner

Summary

Closes the P1 bug from #53. The approvals page rendered every pending card at once — with 100 items the scroll area hit ~29,210px and the "Recent decisions" section was buried below it.

Now: first 10 cards render by default with a "Show N more (M remaining)" button. Click reveals the next 10 in place — no re-fetch, no scroll jump.

Behavior

  • 0 pending → existing empty state
  • 1-10 pending → renders all, no button (existing behavior)
  • 11+ pending → renders 10 + "Show 10 more (90 remaining)" button
  • Each click adds 10 more
  • Page navigations reset the visible count to 10 (mid-paginate state intentionally not persisted)

Test plan

  • `node --check apps/web/public/js/pages/approvals.js` — clean
  • `pnpm test` — 38/38 turbo tasks
  • `pnpm lint` — 30/30 turbo tasks
  • Manual smoke (operator): navigate to approvals page with ≥11 pending items, confirm only 10 render, click "Show 10 more", confirm count + button update correctly

Refs #53 (P1)

🤖 Generated with Claude Code

Closes the P1 bug from #53. Approvals page now renders the first 10
pending cards by default with a "Show N more (M remaining)" button at
the bottom. Clicking the button reveals the next 10 in place — no
re-fetch, no scroll jump.

Before: with 100 pending items, the page rendered a 29,210px scroll
area and the "Recent decisions" section was ~29K pixels below the fold.
After: ~3,000px initial render; user pages through if they want more.

The pagination state lives in module-scope variables that reset on
every renderApprovals() call (full page navigations refresh the
cache). Mid-paginate state is intentionally lost on navigation —
re-rendering the whole page if approvals change is the simpler model.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 26, 2026 23:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds client-side “load more” pagination to the Approvals page to avoid rendering large pending queues (e.g., 100 cards) in one pass and to keep the “Recent decisions” section accessible.

Changes:

  • Introduces a pending page size constant and module-scoped caching for the fetched pending approvals.
  • Renders only the first N pending approvals by default and adds a “Show more” button to reveal additional batches without refetching.
  • Resets the visible pending count on each full renderApprovals() call.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +93 to +97
window.showMoreApprovals = function() {
visiblePendingCount += PENDING_PAGE_SIZE;
const list = document.getElementById('pending-list');
if (list) list.innerHTML = renderPendingList(cachedPending, visiblePendingCount);
};
@jayzalowitz jayzalowitz merged commit 3512c3f into main Apr 26, 2026
12 checks passed
@jayzalowitz jayzalowitz deleted the jayzalowitz/approvals-pagination branch April 26, 2026 23:32
jayzalowitz added a commit that referenced this pull request Apr 27, 2026
…h work (#87)

Captures eight PRs (#77, #78, #79, #81, #82, #83, #84, #85, #86) under
an [Unreleased] section. No code changes — pure documentation.

Bumping VERSION + cutting a tag is left as a separate decision so the
release moment stays explicit.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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.

2 participants