Skip to content

Commit

Permalink
fixing null check
Browse files Browse the repository at this point in the history
  • Loading branch information
Ark2307 committed Jul 15, 2024
1 parent 8cd5aff commit c1c10ec
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions apps/dashboard/web/polaris_web/web/src/util/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,18 @@ prettifyEpoch(epoch) {
sortFunc: (data, sortKey, sortOrder) => {
if(sortKey === 'displayName'){
let finalArr = data.sort((a, b) => {
const nameA = a?.displayName.toLowerCase() || a?.name.toLowerCase();
const nameB = b?.displayName.toLowerCase() || b?.name.toLowerCase();
let nameA = ""
if(a?.displayName?.length > 0){
nameA = a?.displayName.toLowerCase() ;
}else if(a?.name.length > 0){
nameA = a?.name.toLowerCase();
}
let nameB = ""
if(b?.displayName?.length > 0){
nameB = b?.displayName.toLowerCase() ;
}else if(b?.name.length > 0){
nameB = b?.name.toLowerCase();
}

// Define a regex to check if the name starts with a digit
const startsWithDigitA = /^\d/.test(nameA);
Expand Down

0 comments on commit c1c10ec

Please sign in to comment.