Skip to content

Add pagination to PRs and Issues section#24

Open
kertal wants to merge 6 commits into
mainfrom
claude/add-pagination-prs-issues-f57x8
Open

Add pagination to PRs and Issues section#24
kertal wants to merge 6 commits into
mainfrom
claude/add-pagination-prs-issues-f57x8

Conversation

@kertal

@kertal kertal commented Jan 11, 2026

Copy link
Copy Markdown
Owner

This pull request introduces two main improvements: it adds pagination to the issues and pull requests list view, and it enhances data fetching to filter results by user relevance. Additionally, it includes a fix to prevent duplicate initial data fetches in the main app component. These changes improve usability and performance, especially for users with large numbers of issues or pull requests.

Pagination and UI Improvements:

  • Added pagination to the IssuesAndPRsList view, including a Pagination component, state management for the current page, and logic to display only a subset of results per page. The UI now shows the current page and total pages, and resets to the first page on search text changes. [1] [2] [3] [4] [5] [6] [7]

Data Fetching Enhancements:

  • Updated the data fetching hook (useGitHubDataFetching) to filter issues and PRs so that only items where the user is the author or an assignee are included in the results.

App Initialization Fixes:

  • Added a useRef in App.tsx to ensure the initial data fetch is only triggered once, preventing duplicate fetches. The ref is reset when the user manually starts a new fetch. [1] [2] [3]

claude and others added 3 commits January 10, 2026 23:08
Implements 100 items per page pagination for the IssuesAndPRsList component,
consistent with the EventView pagination implementation. Features include:
- Page state persisted in localStorage
- Reset to page 1 when search text changes
- Page info displayed in header (Page X of Y)
- Pagination controls at bottom of list
Adds post-fetch filtering to ensure only items where the searched user is
the author or an assignee are included in the results. This filters out
items that may be returned by GitHub's search API but don't directly
involve the user.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use a ref to track if the initial fetch has been triggered, preventing
the useEffect from firing twice when handleSearch is recreated due to
dependency changes (indexedDBEvents.length/indexedDBSearchItems.length).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jan 11, 2026

Copy link
Copy Markdown

Deploying git-vegas with  Cloudflare Pages  Cloudflare Pages

Latest commit: c9ed298
Status: ✅  Deploy successful!
Preview URL: https://6eb2a858.git-vegas.pages.dev
Branch Preview URL: https://claude-add-pagination-prs-is.git-vegas.pages.dev

View logs

Each section now has its own independent pagination with 100 items per page:
- PRs section: separate page state stored in localStorage
- Issues section: separate page state stored in localStorage
- Page info shown in each section header (e.g., "Page 1 of 3")
- Pagination controls at bottom of each section
- Both sections reset to page 1 when search text changes
@kertal
kertal requested a review from Copilot January 11, 2026 20:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds pagination functionality to the Issues and PRs list view, filters data to show only user-relevant items, and fixes a duplicate fetch bug during app initialization.

Changes:

  • Implemented pagination for both PRs and Issues sections with 100 items per page, including page state management and UI controls
  • Added filtering in data fetching to include only items where the authenticated user is the author or assignee
  • Fixed duplicate initial data fetch using a ref to track whether the initial fetch has been triggered

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/views/IssuesAndPRsList.tsx Added pagination state, UI components, and logic to display paginated results for PRs and Issues sections
src/hooks/useGitHubDataFetching.ts Added filtering to include only issues/PRs where user is author or assignee
src/App.tsx Added ref to prevent duplicate initial data fetches

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

Comment thread src/views/IssuesAndPRsList.tsx Outdated
useEffect(() => {
setPrsCurrentPage(1);
setIssuesCurrentPage(1);
}, [searchText]);

Copilot AI Jan 11, 2026

Copy link

Choose a reason for hiding this comment

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

Missing dependencies in useEffect. The effect uses setPrsCurrentPage and setIssuesCurrentPage from useLocalStorage hooks but they're not included in the dependency array. Add them to the dependency array to follow the exhaustive-deps rule.

Suggested change
}, [searchText]);
}, [searchText, setPrsCurrentPage, setIssuesCurrentPage]);

Copilot uses AI. Check for mistakes.
Comment thread src/views/IssuesAndPRsList.tsx Outdated
Comment on lines +168 to +172
}, []);

const handleIssuesPageChange = useCallback((_event: React.MouseEvent, page: number) => {
setIssuesCurrentPage(page);
}, []);

Copilot AI Jan 11, 2026

Copy link

Choose a reason for hiding this comment

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

Missing dependency in useCallback. The callback uses setPrsCurrentPage but it's not included in the dependency array. Add setPrsCurrentPage to the dependency array.

Suggested change
}, []);
const handleIssuesPageChange = useCallback((_event: React.MouseEvent, page: number) => {
setIssuesCurrentPage(page);
}, []);
}, [setPrsCurrentPage]);
const handleIssuesPageChange = useCallback((_event: React.MouseEvent, page: number) => {
setIssuesCurrentPage(page);
}, [setIssuesCurrentPage]);

Copilot uses AI. Check for mistakes.
Comment thread src/views/IssuesAndPRsList.tsx Outdated

const handleIssuesPageChange = useCallback((_event: React.MouseEvent, page: number) => {
setIssuesCurrentPage(page);
}, []);

Copilot AI Jan 11, 2026

Copy link

Choose a reason for hiding this comment

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

Missing dependency in useCallback. The callback uses setIssuesCurrentPage but it's not included in the dependency array. Add setIssuesCurrentPage to the dependency array.

Suggested change
}, []);
}, [setIssuesCurrentPage]);

Copilot uses AI. Check for mistakes.
Resolved conflicts by taking main's refactored versions:
- App.tsx: uses isTestEnvironment() helper
- useGitHubDataFetching.ts: paginated search with progress count
- IssuesAndPRsList.tsx: cleaner per-section pagination with
  SectionContent component, useListSelection, useDialogNavigation hooks
Adds 100 items per page pagination to each section in the Summary view,
consistent with the IssuesAndPRsList pagination approach:
- Per-section page state stored in localStorage (summary-sectionPages)
- Pagination controls at bottom of each section when needed
- Pages reset when search text changes
- Paginates URL groups (not raw items) since Summary deduplicates by URL
@kertal
kertal marked this pull request as ready for review February 19, 2026 16:10
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.

3 participants