From 9091b9b82cf9268ba67cf9d395bff5a0fb1ba2d8 Mon Sep 17 00:00:00 2001 From: Palash Gupta Date: Mon, 5 Jun 2023 12:13:24 +0530 Subject: [PATCH] fix: sorter is updated for sorting in alerts page (#2818) --- frontend/src/container/ListAlertRules/ListAlert.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/container/ListAlertRules/ListAlert.tsx b/frontend/src/container/ListAlertRules/ListAlert.tsx index 1633689747..41e69c718b 100644 --- a/frontend/src/container/ListAlertRules/ListAlert.tsx +++ b/frontend/src/container/ListAlertRules/ListAlert.tsx @@ -100,9 +100,12 @@ function ListAlert({ allAlertRules, refetch }: ListAlertProps): JSX.Element { dataIndex: 'alert', width: 100, key: 'name', - sorter: (a, b): number => - (a.alert ? a.alert.charCodeAt(0) : 1000) - - (b.alert ? b.alert.charCodeAt(0) : 1000), + sorter: (alertA, alertB): number => { + if (alertA.alert && alertB.alert) { + return alertA.alert.localeCompare(alertB.alert); + } + return 0; + }, render: (value, record): JSX.Element => ( onEditHandler(record)}> {value}