From 86ad5b65090d5e5e7518554fd970d696eee8de81 Mon Sep 17 00:00:00 2001 From: himaniraghav3 Date: Tue, 29 Jul 2025 15:24:01 +0530 Subject: [PATCH] PM-1526 Fix copilot requests sorting on title --- .../lib/components/table/table-functions/table.functions.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libs/ui/lib/components/table/table-functions/table.functions.ts b/src/libs/ui/lib/components/table/table-functions/table.functions.ts index 10fd8bbde..736b58eff 100644 --- a/src/libs/ui/lib/components/table/table-functions/table.functions.ts +++ b/src/libs/ui/lib/components/table/table-functions/table.functions.ts @@ -65,6 +65,11 @@ export function getSorted( .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) : bField.localeCompare(aField)