Skip to content

Commit

Permalink
🐛 - fix: fix incorrect handling of null values
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvandescheur committed Feb 27, 2024
1 parent 60c8958 commit 763d776
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/data/value/value.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const Value: React.FC<ValueProps> = ({
}

if (isNull(value)) {
return "-";
return <P {...pProps}>-</P>;
}

const string = String(value);
Expand Down
7 changes: 5 additions & 2 deletions src/lib/data/attributedata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ export const sortAttributeDataArray = <T = AttributeData>(
const valueB = b[field];

// Use String.localeCompare for strings.
if (typeof valueA === "string" && typeof valueB === "string") {
return multiplier * valueA.localeCompare(valueB);
if (typeof valueA === "string" || typeof valueB === "string") {
return (
multiplier *
((valueA || "") as string).localeCompare((valueB || "") as string)
);
}

return (
Expand Down

0 comments on commit 763d776

Please sign in to comment.