Skip to content

PM-1526 Fix copilot requests sorting on title #1159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ export function getSorted<T extends { [propertyName: string]: any }>(
.sort((a: T, b: T) => {
const aField: string = a[sort.fieldName]
const bField: string = b[sort.fieldName]

// Handle undefined/null values safely
if (aField === undefined && bField === undefined) return 0
if (aField === undefined) return 1
if (bField === undefined) return -1
return sort.direction === 'asc'
? aField.localeCompare(bField)

Choose a reason for hiding this comment

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

Consider adding a check for null values in addition to undefined when comparing aField and bField. This ensures that both null and undefined are handled consistently, as the current implementation only checks for undefined. You might want to use aField == null and bField == null to cover both cases.

: bField.localeCompare(aField)
Expand Down