Skip to content

Commit

Permalink
Check for undefined instead of cast
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbrophy committed Feb 24, 2025
1 parent a10b83c commit f138317
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export const StorageTable = () => {
<TableBody>
{Object.values(storageData)
.sort((a, b) => {
const nameA = (a.serverName || '').toUpperCase();
const nameB = (b.serverName || '').toUpperCase();
const nameA = a.serverName.toUpperCase();
const nameB = b.serverName.toUpperCase();
return nameA > nameB ? 1 : nameA < nameB ? -1 : 0;
})
.map((d) => (
Expand Down Expand Up @@ -138,6 +138,10 @@ const getStorageData = async (
const serverName = r.metric.server_name;
const type = r.metric.type;

if(serverName === undefined) {
return acc;
}

acc[serverName] = {
...acc?.[serverName],
serverName: serverName,
Expand Down

0 comments on commit f138317

Please sign in to comment.