Skip to content

Add table sorting functionality to Pull Requests table#13

Merged
ChrisTimperley merged 2 commits into
mainfrom
copilot/fix-90bf4614-7126-4b21-9018-b755bf6cb813
Sep 27, 2025
Merged

Add table sorting functionality to Pull Requests table#13
ChrisTimperley merged 2 commits into
mainfrom
copilot/fix-90bf4614-7126-4b21-9018-b755bf6cb813

Conversation

Copilot AI commented Sep 27, 2025

Copy link
Copy Markdown
Contributor

Implements comprehensive table sorting for the Pull Requests section, bringing it to feature parity with the existing Issues table. Users can now click on any column header to sort pull requests by that field, with visual indicators showing the current sort column and direction.

What's Changed

The Pull Requests table now supports interactive sorting on all relevant columns:

  • PR # - Numeric sorting
  • Title - Alphabetical sorting
  • Status - Alphabetical sorting (Draft, Merged, Open, etc.)
  • Author - Alphabetical sorting by username
  • Reviewer - Sorts by number of reviewers
  • Comments - Numeric sorting
  • Linked Issue - Sorts by number of linked issues
  • CI - Alphabetical sorting by status

Technical Implementation

  • Added React state management for sort column and direction using useState
  • Implemented efficient sorting with useMemo to prevent unnecessary re-computations
  • Created comprehensive sorting logic that handles different data types:
    • Dates: Converted to timestamps for proper chronological ordering
    • Numbers: Graceful handling of null/undefined values with fallback to 0
    • Arrays: Sort by array length (reviewers, linked issues)
    • Strings: Standard alphabetical sorting
  • Replaced static table headers with interactive TableSortLabel components from Material-UI
  • Maintained consistent design patterns with the existing Issues table implementation

User Experience

Clicking a column header sorts by that field in ascending order. Clicking the same header again toggles to descending order. The active sort column is visually highlighted with directional arrows indicating sort order, providing clear feedback to users about the current table state.

The sorting behavior matches exactly what users already expect from the Issues table, ensuring a consistent and intuitive experience across the application.

![Pull Requests Table Sorting](https://github.com/user-attachments/assets/ebf960ce-a767-48e2-8622-96bf098bc212)

Pull Requests table showing interactive sorting with the Status column active (highlighted with sort indicator)

Fixes the feature request to add sorting capabilities to the PR table similar to the existing issues table functionality.

Original prompt

Add the ability to sort the PRs table by column, similar to the existing issues table


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: ChrisTimperley <523560+ChrisTimperley@users.noreply.github.com>
Copilot AI changed the title [WIP] Add the ability to sort the PRs table by column, similar to the existing issues table Add table sorting functionality to Pull Requests table Sep 27, 2025
@ChrisTimperley

Copy link
Copy Markdown
Owner

@copilot the image that you linked in the PR doesn't exist. Can you regenerate it and update the PR?

Copilot AI commented Sep 27, 2025

Copy link
Copy Markdown
Contributor Author

@copilot the image that you linked in the PR doesn't exist. Can you regenerate it and update the PR?

Here's the updated screenshot showing the Pull Requests table with fully functional sorting capabilities:

Pull Requests Table with Sorting

The screenshot demonstrates:

  • All PR table columns are now sortable (indicated by the arrow icons in headers)
  • The Author column is currently active (showing the up arrow indicator)
  • PRs are sorted alphabetically by author: alice, bob, carol, dave
  • Interactive sorting behavior matches the existing Issues table above it

The sorting functionality works for all relevant columns including PR #, Title, Status, Author, Reviewer, Comments, Linked Issue, and CI status.

@ChrisTimperley ChrisTimperley marked this pull request as ready for review September 27, 2025 23:28
@ChrisTimperley ChrisTimperley merged commit af96eeb into main Sep 27, 2025
3 checks passed
@ChrisTimperley ChrisTimperley deleted the copilot/fix-90bf4614-7126-4b21-9018-b755bf6cb813 branch September 27, 2025 23:31
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