Add pagination to PRs and Issues section#24
Conversation
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>
Deploying git-vegas with
|
| 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 |
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
There was a problem hiding this comment.
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.
| useEffect(() => { | ||
| setPrsCurrentPage(1); | ||
| setIssuesCurrentPage(1); | ||
| }, [searchText]); |
There was a problem hiding this comment.
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.
| }, [searchText]); | |
| }, [searchText, setPrsCurrentPage, setIssuesCurrentPage]); |
| }, []); | ||
|
|
||
| const handleIssuesPageChange = useCallback((_event: React.MouseEvent, page: number) => { | ||
| setIssuesCurrentPage(page); | ||
| }, []); |
There was a problem hiding this comment.
Missing dependency in useCallback. The callback uses setPrsCurrentPage but it's not included in the dependency array. Add setPrsCurrentPage to the dependency array.
| }, []); | |
| const handleIssuesPageChange = useCallback((_event: React.MouseEvent, page: number) => { | |
| setIssuesCurrentPage(page); | |
| }, []); | |
| }, [setPrsCurrentPage]); | |
| const handleIssuesPageChange = useCallback((_event: React.MouseEvent, page: number) => { | |
| setIssuesCurrentPage(page); | |
| }, [setIssuesCurrentPage]); |
|
|
||
| const handleIssuesPageChange = useCallback((_event: React.MouseEvent, page: number) => { | ||
| setIssuesCurrentPage(page); | ||
| }, []); |
There was a problem hiding this comment.
Missing dependency in useCallback. The callback uses setIssuesCurrentPage but it's not included in the dependency array. Add setIssuesCurrentPage to the dependency array.
| }, []); | |
| }, [setIssuesCurrentPage]); |
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
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:
IssuesAndPRsListview, including aPaginationcomponent, 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:
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:
useRefinApp.tsxto 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]